-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Allow extensions to get a LanguageConfiguration for a language #2871
Comments
fyi @jrieken |
I need this as well. I am writing an extension that enhances other language extensions and need to look up things like what autoclosing pairs are defined. |
I also need this to retrieve information about the comments for the current language. |
A little hack that I have done is
This little hack seems to work for all of the default languages for vscode. I would however love to have api to have access to this. |
I know it's been some time, but I have encountered the same problem. Fetching the "language-configuration.json" file using the "languageId" is not reliable since some languages uses "-language-configuration.json" ("javascript" for example) or the folder of the extension itself does not correspond to the languageId ("dockerfile" being inside the "docker" extension folder for example). Anybody found a good work-around? |
ok, I found a pretty good way:
Note: I would recommend that you use an external node module that parses json containing comments (comment-json for example) instead of require(...), since some of vscode's language-configuration have some. Making them invalid JSON which breaks require() and JSON.parse. |
I was wondering if there is any plan to resolve this (expose the current document's language configuration)? I don't like the workarounds above which are clever, but hacky and not guaranteed to work. I am the author of the psioniq File Header extension, and at the moment, the only way to define the comment start/end/prefix is to include it in my extension's configuration. This requires users to unnecessarily duplicate configuration settings that are already (and more safely) part of the language config. |
This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation. Happy Coding! |
🙂 This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation. Happy Coding! |
I would also need this for ESLint. |
Duplicate of #109919 |
As far as I can tell, extensions can set a
LanguageConfiguration
object for a language withlanguages.setLanguageConfiguration()
, but they can't get an existing one. This would be very useful for getting information about the language of the current document.The text was updated successfully, but these errors were encountered: