
Hi we have an existing application using SyntaxEditor and a custom language.
Is there a way to check and prompt if user enter an undeclared variable, similar to VS error IDE1007: The name 'xxx' does not exist in the current context.
Thanks.
Hi we have an existing application using SyntaxEditor and a custom language.
Is there a way to check and prompt if user enter an undeclared variable, similar to VS error IDE1007: The name 'xxx' does not exist in the current context.
Thanks.
Hello,
That kind of thing could be done in a parsing phase. Please see the Parsing documentation topics for more information on how to configure a parser for your custom syntax language. If configured properly, parsers can run in a worker thread so that they don't impact editing performance on the main UI thread. They can scan the document's tokens and do things like build up an AST, report syntax errors, etc.
The error you describe is generally more of a compiler error. If you have a compiler for your language, you could invoke it as part of your syntax language parser service's logic and return its errors. If your IParseData that is returned by the parser implements IParseErrorProvider and you've registered a ParserErrorTagger provider language service, you can get those errors to show as squiggles. See the end of this documentation topic for some related info. Combine that with a SquiggleTagQuickInfoProvider language service, and that will show quick info tips for the errors as well.
Please log in to a validated account to post comments.