Skip to content

Commit

Permalink
chore: remove todo's and fix JDT warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenporras committed Oct 3, 2024
1 parent 7fbba6b commit f63d82f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public <U> MockTextDocumentService(Function<U, CompletableFuture<U>> futureFacto
this.codeActionRequests = 0;
}

@SuppressWarnings("unchecked")
private <U> CompletableFuture<U> futureFactory(U value) {
return ((Function<U, CompletableFuture<U>>) this._futureFactory).apply(value);
}
Expand Down Expand Up @@ -183,11 +184,10 @@ public CompletableFuture<LinkedEditingRanges> linkedEditingRange(LinkedEditingRa
@Override
public CompletableFuture<List<Either<SymbolInformation, DocumentSymbol>>> documentSymbol(
DocumentSymbolParams params) {
return CompletableFuture.completedFuture(documentSymbols.stream()
.map(symbol -> {
Either<SymbolInformation, DocumentSymbol> res = Either.forRight(symbol);
return res;
}).toList());
return CompletableFuture.completedFuture(documentSymbols.stream().map(symbol -> {
Either<SymbolInformation, DocumentSymbol> res = Either.forRight(symbol);
return res;
}).toList());
}

@Override
Expand All @@ -208,8 +208,9 @@ public CompletableFuture<List<? extends CodeLens>> codeLens(CodeLensParams param
}
File file = new File(URI.create(params.getTextDocument().getUri()));
if (file.exists() && file.length() > 100) {
return CompletableFuture.completedFuture(List.of(new CodeLens(
new Range(new Position(1, 0), new Position(1, 1)), new Command("Hi, I'm a CodeLens", null), null)));
return CompletableFuture
.completedFuture(List.of(new CodeLens(new Range(new Position(1, 0), new Position(1, 1)),
new Command("Hi, I'm a CodeLens", null), null)));
}
return CompletableFuture.completedFuture(Collections.emptyList());
}
Expand Down Expand Up @@ -459,23 +460,26 @@ public CompletableFuture<SemanticTokens> semanticTokensFull(SemanticTokensParams

@Override
public CompletableFuture<List<TypeHierarchyItem>> prepareTypeHierarchy(TypeHierarchyPrepareParams params) {
return CompletableFuture.completedFuture(List.of(new TypeHierarchyItem("a", SymbolKind.Class, params.getTextDocument().getUri(), DUMMY_RANGE, DUMMY_RANGE, null)));
return CompletableFuture.completedFuture(List.of(new TypeHierarchyItem("a", SymbolKind.Class,
params.getTextDocument().getUri(), DUMMY_RANGE, DUMMY_RANGE, null)));
}

@Override
public CompletableFuture<List<TypeHierarchyItem>> typeHierarchySubtypes(TypeHierarchySubtypesParams params) {
return CompletableFuture.completedFuture(List.of(
new TypeHierarchyItem(params.getItem().getName() + "a", SymbolKind.Class, params.getItem().getUri() + "/a", DUMMY_RANGE, DUMMY_RANGE, null),
new TypeHierarchyItem(params.getItem().getName() + "b", SymbolKind.Class, params.getItem().getUri() + "/b", DUMMY_RANGE, DUMMY_RANGE, null)
));
new TypeHierarchyItem(params.getItem().getName() + "a", SymbolKind.Class,
params.getItem().getUri() + "/a", DUMMY_RANGE, DUMMY_RANGE, null),
new TypeHierarchyItem(params.getItem().getName() + "b", SymbolKind.Class,
params.getItem().getUri() + "/b", DUMMY_RANGE, DUMMY_RANGE, null)));
}

@Override
public CompletableFuture<List<TypeHierarchyItem>> typeHierarchySupertypes(TypeHierarchySupertypesParams params) {
return CompletableFuture.completedFuture(List.of(
new TypeHierarchyItem("X" + params.getItem().getName(), SymbolKind.Class, params.getItem().getUri() + "/X", DUMMY_RANGE, DUMMY_RANGE, null),
new TypeHierarchyItem("Y" + params.getItem().getName(), SymbolKind.Class, params.getItem().getUri() + "/Y", DUMMY_RANGE, DUMMY_RANGE, null)
));
new TypeHierarchyItem("X" + params.getItem().getName(), SymbolKind.Class,
params.getItem().getUri() + "/X", DUMMY_RANGE, DUMMY_RANGE, null),
new TypeHierarchyItem("Y" + params.getItem().getName(), SymbolKind.Class,
params.getItem().getUri() + "/Y", DUMMY_RANGE, DUMMY_RANGE, null)));
}

public void setFoldingRanges(List<FoldingRange> foldingRanges) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,32 +38,31 @@ public <U> MockWorkspaceService(Function<U, CompletableFuture<U>> futureFactory)
}

/**
* Use this method to get a future that will wait specified delay before returning
* value
* @param value the value that will be returned by the future
* @return a future that completes to value, after delay from {@link MockLanguageServer#delay}
* Use this method to get a future that will wait specified delay before
* returning value
*
* @param value
* the value that will be returned by the future
* @return a future that completes to value, after delay from
* {@link MockLanguageServer#delay}
*/
@SuppressWarnings("unchecked")
private <U> CompletableFuture<U> futureFactory(U value) {
return ((Function<U, CompletableFuture<U>>)this._futureFactory).apply(value);
return ((Function<U, CompletableFuture<U>>) this._futureFactory).apply(value);
}

@Override
public CompletableFuture<Either<List<? extends SymbolInformation>, List<? extends WorkspaceSymbol>>> symbol(
WorkspaceSymbolParams params) {
// TODO Auto-generated method stub
return null;
}

@Override
public void didChangeConfiguration(DidChangeConfigurationParams params) {
// TODO Auto-generated method stub

}

@Override
public void didChangeWatchedFiles(DidChangeWatchedFilesParams params) {
// TODO Auto-generated method stub

}

@Override
Expand Down

0 comments on commit f63d82f

Please sign in to comment.