Visual Studio Developer Center >
Visual Studio Forums
>
Visual Studio Extensibility
>
LanguageService for built-in language
LanguageService for built-in language
- Hi!
How could one associate his custom language service with an extension already supported by Visual Studio? I would like to implement custom language service for JavaScript. However this simply doesn't work:
[ProvideLanguageExtension(typeof(MyLanguageService), ".js")]
I am sure my language service works because it is successfully loaded if I change the extension. What else needs to be done? Is there any example I can look at?
Thanks.
Answers
- Hi,
Can you give an example of using your language service with already registered extension?
I suppose, that users of JavaScript Language Service might use it by explicitly specifying it's GUID.
You can also provide [ProvideEditorExtension(typeof(...), ".js", 100)] attribute and create your own editor factory for javaScript files. - Thank you guys!
I followed the example for instantiating the CoreEditor from the MSDN and voila - everyting is up and running now! Now my language service is successfully being instantiated for .js files and I can proceed with my work. Thank you once again!
All Replies
- Hi,
Can you give an example of using your language service with already registered extension?
I suppose, that users of JavaScript Language Service might use it by explicitly specifying it's GUID.
You can also provide [ProvideEditorExtension(typeof(...), ".js", 100)] attribute and create your own editor factory for javaScript files. - Hi Rustam!
Thank you for you response.
Rustam Kulenov wrote:
Can you give an example of using your language service with already registered extension?
I suppose I didn't express myself correctly. What I meant was that my language service worked ok for other (unregistered) extensions such as ".jsx". What I really need is to hook my language service for the .js extension.
Rustam Kulenov wrote:
I suppose, that users of JavaScript Language Service might use it by explicitly specifying it's GUID.
I want to completely override the existing (built-in) JavaScript language service. I don't plan to rely on it.
Rustam Kulenov wrote:
You can also provide [ProvideEditorExtension(typeof(...), ".js", 100)] attribute and create your own editor factory for javaScript files.
I have to try that out and see if it works for me. Thank you for the suggestion.
Best regards. Each editor determines the language service it uses, so I think your only option is as suggested to create a custom editor and register this with a higher priority than the default of 40 registered for .js (at least this is the default on my system).
You can do this fairly simply by creating an EditorFactory that instantiates the CoreEditor.
Mike
- Thank you guys!
I followed the example for instantiating the CoreEditor from the MSDN and voila - everyting is up and running now! Now my language service is successfully being instantiated for .js files and I can proceed with my work. Thank you once again!


