Skip to content

Commit

Permalink
Add stubs for setTrace and cancelProgress (#183)
Browse files Browse the repository at this point in the history
Lsp4j provides default implementations of these methods in the
LanguageServer interface, which throw exceptions. Even though we don't
support this server side, better to give a warning than shutdown the
server.
  • Loading branch information
milesziemer authored Dec 18, 2024
1 parent 30c386a commit 5c9c72d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/main/java/software/amazon/smithy/lsp/SmithyLanguageServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
import org.eclipse.lsp4j.Registration;
import org.eclipse.lsp4j.RegistrationParams;
import org.eclipse.lsp4j.ServerCapabilities;
import org.eclipse.lsp4j.SetTraceParams;
import org.eclipse.lsp4j.SymbolInformation;
import org.eclipse.lsp4j.SymbolKind;
import org.eclipse.lsp4j.TextDocumentChangeRegistrationOptions;
Expand All @@ -84,6 +85,7 @@
import org.eclipse.lsp4j.Unregistration;
import org.eclipse.lsp4j.UnregistrationParams;
import org.eclipse.lsp4j.WorkDoneProgressBegin;
import org.eclipse.lsp4j.WorkDoneProgressCancelParams;
import org.eclipse.lsp4j.WorkDoneProgressEnd;
import org.eclipse.lsp4j.WorkspaceFolder;
import org.eclipse.lsp4j.WorkspaceFoldersOptions;
Expand Down Expand Up @@ -351,6 +353,21 @@ public void exit() {
System.exit(0);
}

@Override
public void cancelProgress(WorkDoneProgressCancelParams params) {
// TODO: Right now this stub just avoids a possible runtime error from the default
// impl in lsp4j. If we start using work done tokens, we will want to support canceling
// them here.
LOGGER.warning("window/workDoneProgress/cancel not implemented");
}

@Override
public void setTrace(SetTraceParams params) {
// TODO: Eventually when we set up better logging, maybe there's something to do here.
// For now, this stub just avoids a runtime error from the default impl in lsp4j.
LOGGER.warning("$/setTrace not implemented");
}

@Override
public CompletableFuture<String> jarFileContents(TextDocumentIdentifier textDocumentIdentifier) {
LOGGER.finest("JarFileContents");
Expand Down

0 comments on commit 5c9c72d

Please sign in to comment.