Language Service High Level View RRS feed

  • Question

  • Hi all,

    I've been attempting to implement a Language Service, and have run into several problems. So far, I've found solutions around them, but I'm certain they're hacky, and I'm drifting further and further away from what the LS is meant to offer. At the moment, the Extension is an amalgamation of Language Service and 'old school' approaches, and I'm trying to integrate the existing syntax highlighting and error reporting code with the 'Language Service' way of doing things.

    Before I begin, I have some questions with what I have at the moment:

    • Is ParseRequest.Sink.AddError() meant to add the error to the Error List automatically? It squiggles the error in the text view, but doesn't list it in the Error List. The documentation hints that it does it for you, and there's no way of retrieving the errors afterwards (as the List<> 'errors') is private.
    • When implementing syntax highlighting, what calls Colorizer.ColorizeLine(), and what uses the uint[] attrs parameter to actually colour the code? Is it meant to do this automatically too?

    At the moment, my LanguagePackage class (the entry point to the application, implements Package, IOleComponent) registers and proffers the LanguageService, as the MSDN document describes. But at this stage in the process the IVsTextBuffer and IVsTextView are not known as there's no open file. The package gets round this by having another class register the file extension and implement the IClassifier interface, which further initialises the LS with the text objects to pass to the CodeWindowManagers and so on. This feels incredibly hacky.

    My (main) question is therefore, how do all the classes relate to one another? What is responsible for giving the Language Service the vsTextBuffers/vsTextViews created when a file is opened? What is the central component of the Extension meant to be? The LanguagePackage?

    EDIT: I've also noticed that when I add [ProvideLanguageExtension] to the top of my LanguagePackage class (along with ProvideService, and ProvideLanguageService), the extension loads fine, but when I open up an associated file, no code window is shown, and when I click in the code window area, visual studio hangs for a couple of minutes, before it gives up. No editor window is displayed at all. What functionality am I meant to implement before this works correctly?

    • Edited by Fraser Cormack Tuesday, July 24, 2012 5:02 PM Additional question
    Tuesday, July 24, 2012 1:57 PM


All replies