-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
How to have intellisense only show 'clean' Javascript? #61
Comments
You can do this by disabling the built-in type definition library, then including one of the alternates that typescript provides. Disabling the built-in library is done by passing noLib to setCompilerOptions: Once noLib is set, you wont have any typings whatsoever, including javascript primitives. Let's fix that. You can add additional typings by using addExtraLib, which hangs off of the javascriptDefaults. Typescript provides some d.ts files that provide the basics for ES5 and ES6, without the browser cruft. Download one of them and find a way to include it in your project. You will need to pass it in as a string.
At the moment, it seems that all extra libs must be registered before the editor is created. Additionally, you cannot remove or change an added lib, even if you use the disposable that addExtraLib returns. This is probably related to https://github.com/Microsoft/monaco-typescript/issues/7 You can play around with this method in the Playground |
I tried this with the editor in TypeScript mode. This has no effect:
This turns off all intellisense and no adding of facts changes that:
|
Similar boat to jwulf here.
has no effect at all, but
kills intellisense altogether, including preventing me from adding my own d.ts files via After setting
Any suggestions? I'm working on a programming environment for middle schoolers (Turtle drawing!), and it's pretty distracting to have so much superfluous noise coming at them when they work in the editor. I want intellisense only on my defined Turtle class... |
To anyone who comes across this thread in the same boat that I was in yesterday, try
before adding your extra definitions via Cheers |
Keep in mind that typescript and javascript modes act with independent settings. In addition, parts of the typescript language attempt to check the file extension you use for your model to determine what language it uses. You can use typescript mode to process javascript, just remember to set the extension to .js when creating the model, and to allowNonTsExtensions as you discovered. Also keep in mind that the javascript and typescript languages run independently, despite being two instances of the same thing. Calling addExtraLib for one will not make it take effect in the other. As a general guideline, we got our solution working very well by keeping everything in typescript mode, creating models by hand with the appropriate file name extensions, and allowing non-ts extensions. |
Hi all. I'm trying to use Monaco for an environment specific to scripting within Adobe applications, and I'm hitting this same issue -- I have no need for any HTML and don't want it to be in the autocompletion. I'm unsure of what I'm doing wrong here:
I've tried multiple variations of the above, scaling up to 2018, but I'm completely unable to isolate HTML without also killing certain Array methods. Without specifying noLib, I get If I specify Would love a solution to this or pointers about what I'm doing wrong |
Hi, |
Looks like exactly the same problem. Thanks for the link! |
I have Monaco working with Javascript content on my page, but it's editing JS that is run in the context of a scripting environment that runs on a server (embedded in a .NET project, but it could as well be NodeJS code). So all the browser-specific JS stuff is not there. I don't want things like
alert()
andscreenX
, etc... showing in the intellisense since they are not applicable, only 'pure' javascript (+ whatever else I add). Is there a configuration setting to fix this (short of writing my own provider)?The text was updated successfully, but these errors were encountered: