You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we would like to use the monaco-editor in a scripting environment where you only write the body of a function without having to specify/worry about the function signature itself. It is added on the server side before the code is executed. E.g.
letresult=0;// compute resultreturnresult;
However, top-level return statements are reported as a syntax error (because they normally are). Is there a way to suppress this specific diagnostic?
A 'return' statement can only be used within a function body.
Being able to do this would make a lot of sense in scripting environments that use the monaco-editor, IMHO.
Thanks!
P.S.: I found #45 as a possible workaround, though I haven't had the time to try that, yet. (And it uses non-API methods)
The text was updated successfully, but these errors were encountered:
Since the methods mentioned in #45 seem to be gone, there is no obvious workaround for this. Is this the right place to ask, or is it rather a feature request for the TypeScript language server to have such an option?
Since there is not option in TypeScript to allow top
level return statements we listen to changes to
decorations and filter the marker list.
microsoft/monaco-editor#1069
👍, this would be extremely useful for various embedded scripting scenarios.
The only option I see for now is to listen to changes of editor's error markers and monkey-patch them to remove the ones we don't want to see :)
Hi,
we would like to use the monaco-editor in a scripting environment where you only write the body of a function without having to specify/worry about the function signature itself. It is added on the server side before the code is executed. E.g.
However, top-level return statements are reported as a syntax error (because they normally are). Is there a way to suppress this specific diagnostic?
Being able to do this would make a lot of sense in scripting environments that use the monaco-editor, IMHO.
Thanks!
P.S.: I found #45 as a possible workaround, though I haven't had the time to try that, yet. (And it uses non-API methods)The text was updated successfully, but these errors were encountered: