Skip to content

[Feature Request] Support intellisense for AMD modules #3731

Answered by manikantag
manikantag asked this question in Q&A
Discussion options

You must be logged in to vote

Never mind... I figured it out... using declaration files I achieved 90% of my requirement: getting proper completions in AMD module with this context of chosen type.

For anyone else having same requirement: Monaco playground link

Main thing to notice is how this is declared to be a specific type in the declaration file which is fed to monaco as a extra lib.

monaco.languages.typescript.javascriptDefaults.addExtraLib(
    'declare function Factory (this: HTMLCanvasElement, n: Number) : void;',   // <----- change the `this` type to whatever you want
    'ts:this-lib.d.ts'
);

Best thing is I don't have to fiddle with the current line/word based logic anymore (and no custom provider is needed…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by hediet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
feature-request Request for new features or functionality
2 participants
Converted from issue

This discussion was converted from issue #3616 on March 07, 2023 10:54.