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

type
$ ./mxmlc -help advanced warn

output

Adobe Flex Compiler (mxmlc)
Version 4.6.0 build 23201
Copyright (c) 2004-2011 Adobe Systems, Inc. All rights reserved.


-compiler.report-invalid-styles-as-warnings
    alias -report-invalid-styles-as-warnings
    enables reporting of invalid styles as warnings
-compiler.report-missing-required-skin-parts-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)
-compiler.show-actionscript-warnings
    alias -show-actionscript-warnings
    runs the AS3 compiler in a mode that detects legal but potentially
    incorrect code
-compiler.show-binding-warnings
    alias -show-binding-warnings
    toggle whether warnings generated from data binding code are
    displayed
-compiler.show-invalid-css-property-warnings
    alias -show-invalid-css-property-warnings
    toggle whether invalid css property warnings are reported
-compiler.show-shadowed-device-font-warnings
    alias -show-shadowed-device-font-warnings
    toggles whether warnings are displayed when an embedded font name
    shadows a device font name
-compiler.show-unused-type-selector-warnings
    alias -show-unused-type-selector-warnings
    toggle whether warnings generated from unused CSS type selectors are
    displayed
-compiler.warn-array-tostring-changes
    alias -warn-array-tostring-changes
    Array.toString() format has changed. (advanced)
-compiler.warn-assignment-within-conditional
    alias -warn-assignment-within-conditional
    Assignment within conditional. (advanced)
-compiler.warn-bad-array-cast
    alias -warn-bad-array-cast
    Possibly invalid Array cast operation. (advanced)
-compiler.warn-bad-bool-assignment
    alias -warn-bad-bool-assignment
    Non-Boolean value used where a Boolean value was expected. (advanced)
-compiler.warn-bad-date-cast
    alias -warn-bad-date-cast
    Invalid Date cast operation. (advanced)
-compiler.warn-bad-es3-type-method
    alias -warn-bad-es3-type-method
    Unknown method. (advanced)
-compiler.warn-bad-es3-type-prop
    alias -warn-bad-es3-type-prop
    Unknown property. (advanced)
-compiler.warn-bad-nan-comparison
    alias -warn-bad-nan-comparison
    Illogical comparison with NaN. Any comparison operation involving NaN
    will evaluate to false because NaN != NaN. (advanced)
-compiler.warn-bad-null-assignment
    alias -warn-bad-null-assignment
    Impossible assignment to null. (advanced)
-compiler.warn-bad-null-comparison
    alias -warn-bad-null-comparison
    Illogical comparison with null. (advanced)
-compiler.warn-bad-undefined-comparison
    alias -warn-bad-undefined-comparison
    Illogical comparison with undefined.  Only untyped variables (or
    variables of type *) can be undefined. (advanced)
-compiler.warn-boolean-constructor-with-no-args
    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)
-compiler.warn-changes-in-resolve
    alias -warn-changes-in-resolve
    __resolve is no longer supported. (advanced)
-compiler.warn-class-is-sealed
    alias -warn-class-is-sealed
    Class is sealed.  It cannot have members added to it dynamically.
    (advanced)
-compiler.warn-const-not-initialized
    alias -warn-const-not-initialized
    Constant not initialized. (advanced)
-compiler.warn-constructor-returns-value
    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.
    (advanced)
-compiler.warn-deprecated-event-handler-error
    alias -warn-deprecated-event-handler-error
    EventHandler was not added as a listener. (advanced)
-compiler.warn-deprecated-function-error
    alias -warn-deprecated-function-error
    Unsupported ActionScript 2.0 function. (advanced)
-compiler.warn-deprecated-property-error
    alias -warn-deprecated-property-error
    Unsupported ActionScript 2.0 property. (advanced)
-compiler.warn-duplicate-argument-names
    alias -warn-duplicate-argument-names
    More than one argument by the same name. (advanced)
-compiler.warn-duplicate-variable-def
    alias -warn-duplicate-variable-def
    Duplicate variable definition  (advanced)
-compiler.warn-for-var-in-changes
    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)
-compiler.warn-import-hides-class
    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)
-compiler.warn-instance-of-changes
    alias -warn-instance-of-changes
    Use of the instanceof operator. (advanced)
-compiler.warn-internal-error
    alias -warn-internal-error
    Internal error in compiler. (advanced)
-compiler.warn-level-not-supported
    alias -warn-level-not-supported
    _level is no longer supported. For more information, see the
    flash.display package. (advanced)
-compiler.warn-missing-namespace-decl
    alias -warn-missing-namespace-decl
    Missing namespace declaration (e.g. variable is not defined to be
    public, private, etc.). (advanced)
-compiler.warn-negative-uint-literal
    alias -warn-negative-uint-literal
    Negative value will become a large positive value when assigned to a
    uint data type. (advanced)
-compiler.warn-no-constructor
    alias -warn-no-constructor
    Missing constructor. (advanced)
-compiler.warn-no-explicit-super-call-in-constructor
    alias -warn-no-explicit-super-call-in-constructor
    The super() statement was not called within the constructor.
    (advanced)
-compiler.warn-no-type-decl
    alias -warn-no-type-decl
    Missing type declaration. (advanced)
-compiler.warn-number-from-string-changes
    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)
-compiler.warn-scoping-change-in-this
    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)
-compiler.warn-slow-text-field-addition
    alias -warn-slow-text-field-addition
    Inefficient use of += on a TextField. (advanced)
-compiler.warn-unlikely-function-value
    alias -warn-unlikely-function-value
    Possible missing parentheses. (advanced)
-compiler.warn-xml-class-has-changed
    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
    warnings.
-warnings
    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.

edit:
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/Main.as

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-...

OR

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:
<show-actionscript-warnings>true</show-actionscript-warnings>
<warn-no-type-decl>false</warn-no-type-decl>

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:
<show-actionscript-warnings>false</show-actionscript-warnings>
<warn-no-type-decl>true</warn-no-type-decl>
(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.