feat!: Error diagnostics

This commit is contained in:
FalsePattern 2023-08-02 13:56:32 +02:00 committed by FalsePattern
parent 4de6a9f387
commit 8e498d75be
Signed by: falsepattern
GPG key ID: FDF7126A9E124447
4 changed files with 26 additions and 2 deletions

View file

@ -18,6 +18,11 @@ Changelog structure reference:
## [Unreleased] ## [Unreleased]
### Added
#### Error diagnostics (NEW)
- Basic diagnostics info from LSP (mostly just trivial syntax errors)
## [0.3.1] ## [0.3.1]
### Added ### Added

View file

@ -15,6 +15,7 @@ Feature tracker:
- Code completion - Code completion
- Code folding - Code folding
- Syntax highlighting - Syntax highlighting
- Basic error diagnostics
- Go to definition - Go to definition
- Rename symbol - Rename symbol
- Hover documentation - Hover documentation

View file

@ -0,0 +1,19 @@
package com.falsepattern.zigbrains.lsp;
import org.eclipse.lsp4j.InitializeParams;
import org.eclipse.lsp4j.PublishDiagnosticsCapabilities;
import org.wso2.lsp4intellij.client.languageserver.serverdefinition.RawCommandServerDefinition;
public class ZLSServerDefinition extends RawCommandServerDefinition {
public ZLSServerDefinition(String[] command) {
super("zig", command);
}
@Override
public void customizeInitializeParams(InitializeParams params) {
var textCaps = params.getCapabilities().getTextDocument();
if (textCaps.getPublishDiagnostics() == null) {
textCaps.setPublishDiagnostics(new PublishDiagnosticsCapabilities());
}
}
}

View file

@ -88,8 +88,7 @@ public class ZLSStartupActivity implements StartupActivity {
} }
} }
} }
IntellijLanguageClient.addServerDefinition( IntellijLanguageClient.addServerDefinition(new ZLSServerDefinition(cmd.toArray(String[]::new)));
new RawCommandServerDefinition("zig", cmd.toArray(String[]::new)));
} finally { } finally {
lock.unlock(); lock.unlock();
} }