mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 07:49:44 +08:00
Publish java diagnostics to ILanguageClient
This commit is contained in:
Binary file not shown.
@@ -27,6 +27,7 @@ import com.itsaky.androidide.utils.Logger;
|
||||
import com.itsaky.lsp.api.ILanguageServer;
|
||||
import com.itsaky.lsp.models.AnalyzeParams;
|
||||
import com.itsaky.lsp.models.DiagnosticItem;
|
||||
import com.itsaky.lsp.models.DiagnosticResult;
|
||||
import com.itsaky.lsp.models.Position;
|
||||
import com.itsaky.lsp.models.Range;
|
||||
|
||||
@@ -79,6 +80,10 @@ public class JavaAnalyzer extends AbstractCodeAnalyzer {
|
||||
|
||||
JavaAnalyzer.this.diagnostics = result.getDiagnostics ();
|
||||
JavaAnalyzer.this.helper = new HighlightRangeHelper (result.getSemanticHighlights ());
|
||||
|
||||
if (languageServer.getClient () != null) {
|
||||
languageServer.getClient ().publishDiagnostics (new DiagnosticResult (file.toPath (), JavaAnalyzer.this.diagnostics));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -74,6 +74,13 @@ public interface ILanguageServer {
|
||||
*/
|
||||
void connectClient (@Nullable ILanguageClient client);
|
||||
|
||||
/**
|
||||
* Get the instance of the language client connected to this server.
|
||||
* @return The language client.
|
||||
*/
|
||||
@Nullable
|
||||
ILanguageClient getClient ();
|
||||
|
||||
/**
|
||||
* Apply settings to the language server. Its up to the language server how it
|
||||
* applies these settings to the language service providers.
|
||||
|
||||
@@ -141,6 +141,12 @@ public class JavaLanguageServer implements ILanguageServer, IDocumentHandler {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ILanguageClient getClient () {
|
||||
return this.client;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applySettings (@Nullable IServerSettings settings) {
|
||||
this.settings = settings;
|
||||
|
||||
Reference in New Issue
Block a user