Is it possible disable specific warnings in VSCode?

Hi everyone,

I recently moved my project from FlashCS6 to VSCode with ActionScript & MXML extension.
I have a question: is it possible to disable only specific type of compiler warnings: “… has no type declaration”. I have hundreds of functions that don’t return anything and i didn’t use “:void” for them.
In Flash CS6 I didn’t get those warnings.

I know, I can use:
“compilerOptions”: {
“warnings”: false
but this disables all warnings and I would like to keep the rest of them.

look into MXMLC options

$ ./mxmlc -help advanced warn


Adobe Flex Compiler (mxmlc)
Version 4.6.0 build 23201
Copyright (c) 2004-2011 Adobe Systems, Inc. All rights reserved.
    alias -report-invalid-styles-as-warnings
    enables reporting of invalid styles as warnings
    alias -report-missing-required-skin-parts-as-warnings
    Use this option to generate a warning instead of an error when a
    missing required skin part is detected. (advanced)
    alias -show-actionscript-warnings
    runs the AS3 compiler in a mode that detects legal but potentially
    incorrect code
    alias -show-binding-warnings
    toggle whether warnings generated from data binding code are
    alias -show-invalid-css-property-warnings
    toggle whether invalid css property warnings are reported
    alias -show-shadowed-device-font-warnings
    toggles whether warnings are displayed when an embedded font name
    shadows a device font name
    alias -show-unused-type-selector-warnings
    toggle whether warnings generated from unused CSS type selectors are
    alias -warn-array-tostring-changes
    Array.toString() format has changed. (advanced)
    alias -warn-assignment-within-conditional
    Assignment within conditional. (advanced)
    alias -warn-bad-array-cast
    Possibly invalid Array cast operation. (advanced)
    alias -warn-bad-bool-assignment
    Non-Boolean value used where a Boolean value was expected. (advanced)
    alias -warn-bad-date-cast
    Invalid Date cast operation. (advanced)
    alias -warn-bad-es3-type-method
    Unknown method. (advanced)
    alias -warn-bad-es3-type-prop
    Unknown property. (advanced)
    alias -warn-bad-nan-comparison
    Illogical comparison with NaN. Any comparison operation involving NaN
    will evaluate to false because NaN != NaN. (advanced)
    alias -warn-bad-null-assignment
    Impossible assignment to null. (advanced)
    alias -warn-bad-null-comparison
    Illogical comparison with null. (advanced)
    alias -warn-bad-undefined-comparison
    Illogical comparison with undefined.  Only untyped variables (or
    variables of type *) can be undefined. (advanced)
    alias -warn-boolean-constructor-with-no-args
    Boolean() with no arguments returns false in ActionScript 3.0.
    Boolean() returned undefined in ActionScript 2.0. (advanced)
    alias -warn-changes-in-resolve
    __resolve is no longer supported. (advanced)
    alias -warn-class-is-sealed
    Class is sealed.  It cannot have members added to it dynamically.
    alias -warn-const-not-initialized
    Constant not initialized. (advanced)
    alias -warn-constructor-returns-value
    Function used in new expression returns a value.  Result will be what
    the function returns, rather than a new instance of that function.
    alias -warn-deprecated-event-handler-error
    EventHandler was not added as a listener. (advanced)
    alias -warn-deprecated-function-error
    Unsupported ActionScript 2.0 function. (advanced)
    alias -warn-deprecated-property-error
    Unsupported ActionScript 2.0 property. (advanced)
    alias -warn-duplicate-argument-names
    More than one argument by the same name. (advanced)
    alias -warn-duplicate-variable-def
    Duplicate variable definition  (advanced)
    alias -warn-for-var-in-changes
    ActionScript 3.0 iterates over an object's properties within a "for x
    in target" statement in random order. (advanced)
    alias -warn-import-hides-class
    Importing a package by the same name as the current class will hide
    that class identifier in this scope. (advanced)
    alias -warn-instance-of-changes
    Use of the instanceof operator. (advanced)
    alias -warn-internal-error
    Internal error in compiler. (advanced)
    alias -warn-level-not-supported
    _level is no longer supported. For more information, see the
    flash.display package. (advanced)
    alias -warn-missing-namespace-decl
    Missing namespace declaration (e.g. variable is not defined to be
    public, private, etc.). (advanced)
    alias -warn-negative-uint-literal
    Negative value will become a large positive value when assigned to a
    uint data type. (advanced)
    alias -warn-no-constructor
    Missing constructor. (advanced)
    alias -warn-no-explicit-super-call-in-constructor
    The super() statement was not called within the constructor.
    alias -warn-no-type-decl
    Missing type declaration. (advanced)
    alias -warn-number-from-string-changes
    In ActionScript 3.0, white space is ignored and '' returns 0.
    Number() returns NaN in ActionScript 2.0 when the parameter is '' or
    contains white space. (advanced)
    alias -warn-scoping-change-in-this
    Change in scoping for the this keyword.  Class methods extracted from
    an instance of a class will always resolve this back to that
    instance.  In ActionScript 2.0 this is looked up dynamically based on
    where the method is invoked from. (advanced)
    alias -warn-slow-text-field-addition
    Inefficient use of += on a TextField. (advanced)
    alias -warn-unlikely-function-value
    Possible missing parentheses. (advanced)
    alias -warn-xml-class-has-changed
    Possible usage of the ActionScript 2.0 XML class. (advanced)
-tools-locale <string>
    specifies the locale used by the compiler when reporting errors and
    toggle the display of warnings

Thanks for help, however I can’t get it to work. I’ve never used “mxmlc” from command line, so maybe I’m doing something wrong.
I typed:
“./mxmlc -warn-no-type-decl”

I get the output:

Loading configuration: C:\AIRSDK\AIR33.0\frameworks\flex-config.xml
Error: a target file must be specified.

I understand I must specify a target file. But what made me wonder is that’s it’s loading configuration from “flex-config.xml”.
When I compile my project I load from “airmobile-config.xml”, so I suppose changing “flex-config.xml” will not matter.
I looked into those two files and I found:
< warn-no-type-decl>true< /warn-no-type-decl>

I changed it to ‘false’ but I still get a lot of warnings:

Warning: return value for function ‘xxx’ has no type declaration.

However when I changed:
< show-actionscript-warnings>true< /show-actionscript-warnings>
to ‘false’, I don’t get warnings at all, so that part worked.

Ok, I managed to compile swf from command line with:
c:/AIRSDK/AIR33.0/bin/mxmlc --debug=true +configname=airmobile --warn-no-type-decl=false --output=bin/Test.swf --default-frame-rate=60 --default-size 480 800 --library-path+=libs --define+=CONFIG::FCM,true --external-library-path+=src/com/distriqt – src/

so I inderstand it now takes config from airmoble file, however “–warn-no-type-decl=false” still doesn’t work.

when you use +configname=airmobile you accumulate the config files
you will have to check what is setup in the airmobile-config.xml

also that file will show you comments on what the options are doing

I didn’t look into the details but

  • -warnings
    toggle the display of warnings
  • -show-actionscript-warnings
    runs the AS3 compiler in a mode that detects legal but potentially incorrect code
  • -warn-...
    show warning for a specific case

use -warnings as a global on/off switch to show warnings

and then you have to use -show-actionscript-warnings=true
but then you can not select the specific with a -warn-...


you have to use -show-actionscript-warnings=false
and enable/disable every single specific -warn-... you need

finally, use

-dump-config <filename>
    write a file containing all currently set configuration values in a
    format suitable for use as a flex config file (advanced)

to be sure what is actually enabled or not
it will merge all configs and save it all into a single file
so you can inspect it afterwards

Ok, I made changes to config.xml files, and then created “myconf.xml” file using:
-dump-config (as you suggested).
I checked this file and it had:

but when I compiled I still got a lot of “no type declaration” warnings.

Then I changed config files again, and “myconf.xml” (created using -dump-config) had:
(and all other warnings ‘warn-…’ were set to true)

and I got no warnings at all.

Maybe <warn-no-type-decl> doesn’t correspond with the kind of warning that I get:

Warning: return value for function ‘xxx’ has no type declaration.

although the name suggests it should.

seeing the full conf would help

by any chance it could be that if you are using -strict, no m atter what it will shows a warning

in fat, provide a samll coee sample where you expect some part of the code to create such warning and then provide your full config to compile that code

that way other people can test

so far no enough infos from your side

-strict was set to ‘true’, but setting it to ‘false’ doesn’t change anything.

I will try to do some more tests on my own. If I don’t get any results I will try to provide some code.
Thank you for your help.