Create diagnostics entries without language server in Visual Studio Code

前端 未结 1 759
梦谈多话
梦谈多话 2021-01-14 00:35

I have a reasonably simple extension for Visual Studio Code where I want to apply some warning, if possible, without having to implement an entire language server for it. Is

相关标签:
1条回答
  • 2021-01-14 01:30

    So, I was able to do this after a bunch of digging.

    import { languages, Diagnostic, DiagnosticSeverity } from 'vscode';
    
    ... 
    
    let diagnosticCollection = languages.createDiagnosticCollection("stuff");
    let diagnostics : Diagnostic[] = [];
    
    ...
    
    diagnostics.push(new Diagnostic(range, message, DiagnosticSeverity.Warning));
    
    diagnosticCollection.set(document.uri, diagnostics);
    
    0 讨论(0)
提交回复
热议问题