-
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
[TS] Accept all language service parameters #2582
Comments
If @orta has nothing against it, I think this feature is a nice candidate for being contributed by the community. |
I could take a stab at it - since I've already gone into the rabbit hole of figuring some of this stuff for hacking purposes. There are some things that I still don't get and could use some clarification on them before I start coding things. Could the TS language stuff be unified more with what is implemented in the VScode repository? I went spelunking into both repositories (VScode and monaco-typescript), trying to figure out how they relate, on what data types they operate and how do they implement certain things. The overlap is big but so is the divergence between them. Is this mostly a historical reason? And VScode having to handle compatibility with all (most?) TS versions? Is there anything else at play here? Any particular gotchas that you could think of at this stage already? Something I should be aware of? Is there any test suite validating the functionality beyond what can be found here and in the monaco-typescript repository? In those two there are not a lot of tests so I'm a little bit worried that I could unintentionally break some stuff due to lack of experience with those projects. |
Both monaco-typescript and typescript-languge-features (vscode) are two completely separate implementations of a binding for a TS TSServer to the Monaco or VS Code APIs. They both have overlap but generally the fancy features get shipped to vscode as the TS + VS team build out a feature and then if it makes sense for web I (or a community member) sends a PR to monaco-typescript There's probably only 2 params because that's how many params were on that function back when the feature was added, monaco-typescript is probably just ignoring all the newer params. I don't think there's a systemic constraint. You're welcome to add it 👍🏻 |
From what I've seen VScode is currently implementing completionItemProvider using the TSServer API instead of the Language Service API. Would it be possible to rewrite it to the latter (I could potentially try to dig into this)? That way rewriting the one in the Either way - I would love to contribute this to For instance, at the moment, in my monkey-patched "fork" I had to:
|
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. If you wonder what we are up to, please see our roadmap and issue reporting guidelines. Thanks for your understanding, and happy coding! |
Currently, most of the
languageService
methods are capped to certain arguments. For example,getCompletionsAtPosition
only accepts 2 arguments, while the underlying service, in fact, accepts 3 argumentshttps://github.com/microsoft/monaco-typescript/blob/17582eaec0872b9a311ec0dee2853e4fc6ba6cf2/src/tsWorker.ts#L235-L243
The same applies to other methods such as
getCompletionEntryDetails
which got capped to 3 arguments (and it accepts 7!).I understand that allowing those arguments might require some changes in the languageFeatures and maybe in other files too. However, allowing this would make Monaco editor more robust and would unlock some new possibilities for integrators.
Context
I've wanted to enable auto-imports and I've managed to hack my way around by overriding
getCompletionsAtPosition
andgetCompletionEntryDetails
usingcustomWorkerPath
and patching theCompletionItemProvider
/SuggestAdapter
. I had to figure out a lot to do so though and this functionality could be enabled as easily as by callinggetCompletionsAtPosition
withincludeCompletionsForModuleExports: true
.I understand that Monaco's goal is to support single-file editors but we can still "install" external modules with
addExtraLib
and so on so allowing auto-imports to work with those would be awesome. Since TS playground implements "type acquisition", this could nicely enhance the user experience in that playground as well (cc @orta). So I wouldn't say that this feature requires is special to me by any means.The text was updated successfully, but these errors were encountered: