Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monaco JS Code Complete to exclude DOM related stuff #2907

Closed
tomy2105 opened this issue Mar 31, 2022 · 3 comments
Closed

Monaco JS Code Complete to exclude DOM related stuff #2907

tomy2105 opened this issue Mar 31, 2022 · 3 comments

Comments

@tomy2105
Copy link
Contributor

Just built Elsa 2.6 from code and saw Monaco code complete contains a bunch of stuff that is not usable in Elsa JS Expressions, like: CSSAnimation or DOMException.

MonacoCodeComplete

I think Monaco code complete should look at lib.es5.d.ts and lib.es6.d.ts and similar but not at lib.dom.d.ts and similar.
Is this possible?

P.S. I think something like what is described in microsoft/monaco-editor#1001 needs to be done but not sure... :)

@mohdali
Copy link
Member

mohdali commented May 27, 2022

@tomy2105 seems the suggested solution is to set noLib: true in monaco settings and then add the desired auto completion using addExtraLib().

addExtraLib is already being used currently to add the required completions for workflow contexts, variables, etc. However, I'm not sure if there are additional functions supported by JInt that are not included in that typings file. If so, they will also be required to be included.

@sfmskywalker can you please advise on this? does the typings file generated by v1/scripting/javascript/type-definitions/ contain all the desired types? if so then noLib: true could suffice to resolve this issue.

@sfmskywalker
Copy link
Member

v1/scripting/javascript/type-definitions only includes .NET types, not types typically used in JS/TS. I think we need to include both (if possible):

  • lib.es6.ts
  • v1/scripting/javascript/type-definitions

@mohdali
Copy link
Member

mohdali commented May 27, 2022

@sfmskywalker seems that updating the code as below fixes the issue, I no longer get CSS or DOM related stuff.

The content seems irrelevant because it is just reading from the file instead.

I tried with lib.es6.d.ts but that file has reference to Dom related declarations. More detailed referencing may be required.

 monaco.languages.typescript.javascriptDefaults.setExtraLibs([{
      filePath: "lib.es5.d.ts"
    }, {
      content: libSource,
      filePath: libUri
    }]);

mohdali added a commit that referenced this issue May 27, 2022
mlditga pushed a commit to mlditga/elsa-core that referenced this issue May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants