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
Browser: Chrome Version 64.0.3282.186 (Official Build) (64-bit)
OS: High Sierra 10.13.2
Issue
I want to get autocomplete functionality for a third-party library, like lodash, in my Monaco instance. I'm using the addExtraLib method to make this happen, and I'm having trouble getting access to a valid content argument to provide to it.
It seems that the content argument needs to be the actual content of whatever .d.ts file you want to use, and I am unable to require the typings file via import in the browser.
Examples where content is defined in the file work just fine for me:
monaco.languages.typescript.javascriptDefaults.addExtraLib([
'delcare class Facts {',
' /**',
' * Returns the next fact',
' */',
' static next():string',
'}',
].join('\n'), 'filename/facts.d.ts');
However, this won't work for a larger library, as this would require manually updating the hardcoded content value any time the definitions file is changed.
Attempting to import the type definitions with import * as _ from '@types/lodash results in the following error [ts] Cannot import type declaration files. Consider importing 'lodash' instead of '@types/lodash'. However, importing lodash itself and providing that as the content argument for addExtraLib doesn't work either. It's importing the actual javascript library and doesn't communicate any type information to Monaco.
How can I require the contents of a d.ts file as a string in the browser/how can I add auto-complete for a third-party library in Monaco?
The text was updated successfully, but these errors were encountered:
We closed this issue because we don't plan to address it in the foreseeable future. If you disagree and feel that this issue is crucial: we are happy to listen and to reconsider.
monaco-editor version: 0.X.Y
Browser: Chrome Version 64.0.3282.186 (Official Build) (64-bit)
OS: High Sierra 10.13.2
Issue
I want to get autocomplete functionality for a third-party library, like
lodash,
in my Monaco instance. I'm using the addExtraLib method to make this happen, and I'm having trouble getting access to a validcontent
argument to provide to it.It seems that the
content
argument needs to be the actual content of whatever.d.ts
file you want to use, and I am unable to require the typings file viaimport
in the browser.Examples where
content
is defined in the file work just fine for me:However, this won't work for a larger library, as this would require manually updating the hardcoded
content
value any time the definitions file is changed.Attempting to import the type definitions with
import * as _ from '@types/lodash
results in the following error[ts] Cannot import type declaration files. Consider importing 'lodash' instead of '@types/lodash'.
However, importinglodash
itself and providing that as thecontent
argument foraddExtraLib
doesn't work either. It's importing the actual javascript library and doesn't communicate any type information to Monaco.How can I require the contents of a
d.ts
file as a string in the browser/how can I add auto-complete for a third-party library in Monaco?The text was updated successfully, but these errors were encountered: