volarjs / volar.js

💙🌊
https://volarjs.dev/
MIT License
963 stars 47 forks source link

feat(language-server): add support for Workspace Diagnostics #199

Closed johnsoncodehk closed 3 months ago

johnsoncodehk commented 3 months ago

Close #43, implement connection.languages.diagnostics.onWorkspace of language server.

LS Plugin Code Sample

const plugin: LanguageServicePlugin = {
    capabilities: {
        diagnosticProvider: {
            workspaceDiagnostics: true,
        },
    },
    create(context): LanguageServicePluginInstance<Provide> {
        return {
            provideWorkspaceDiagnostics() {
                return [{
                    uri: 'file://a.css',
                    items: [{
                        severity: 2,
                        source: 'html1',
                        message: 'Only one style tag is allowed.',
                        // ...
                    }]
                }];
            }
        };
    },
}