Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Is it possible to call the GetDeclarations method of the XmlLanguageService from my own language service?

$
0
0

I have written a language service for a development language that we use to produce our business logic in. This language looks a lot like XML and in fact we've written an xsd that facilitates using the language in the Visual Studio XmlEditor. However, as soon as I load my language service into Visual Studio, I have to disassociate the file extension (of the business logic file) from the XmlEditor to make my language service work (what it does is to facilitate intellisense that is of a dynamic nature, and therefore cannot be put into an xsd). But of course I would like to be able to use the things the xsd offers as well. I thought the following reasoning would be valid:

The AuthoringSource.GetDeclarations is offered a list of Declarations that holds for example the attributes for a certain xml-tag.  Perhaps I can fake the XmlLanguageService into giving me those attributes if I offer it the location (row, col) in the text where it would normally produce them. I tried it thus (which, as you certainly guessed, doesn't work):

public XmlLanguageService GetXmlLanguageService()
{return (XmlLanguageService)this.GetService(typeof(XmlLanguageService));
}
private Declarations GetSomething(IVsTextView vsTextView, int line, int column, TokenInfo info, ParseReason reason)
{XmlLanguageService xmlLanguageService = wflLanguageService.GetXmlLanguageService();IVsTextLines textLines;
	vsTextView.GetBuffer(out textLines);Source source = xmlLanguageService.CreateSource(textLines);

	Microsoft.XmlEditor.XmlDocument doc = xmlLanguageService.GetParseTree(
		source,
		vsTextView,
		line,
		column,
		reason);

	info.Trigger = TokenTriggers.Parameter;
	info.Type = TokenType.Keyword;AuthoringScope authoringScope = xmlLanguageService.GetAuthoringScope(doc);Declarations decls = authoringScope.GetDeclarations(vsTextView, line, column, info, reason);return decls;
}

My questions are:

Is there someone who might help me in this?

Is what I'm trying to do even possible?


 

Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>