Skip to content

Commit ae68b8e

Browse files
committed
GH-1153: due to the new insert text mode setting <as-is>, we do not need to deal with client-side magic indentation anymore
1 parent d71fc6f commit ae68b8e

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

headless-services/commons/commons-language-server/src/main/java/org/springframework/ide/vscode/commons/languageserver/completion/VscodeCompletionEngineAdapter.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,11 @@ public VscodeCompletionEngineAdapter(SimpleLanguageServer server, ICompletionEng
148148
String resolveId = params.getArguments().get(1) instanceof String ? (String) params.getArguments().get(1) : ((JsonElement) params.getArguments().get(1)).getAsString();
149149
JsonElement editJson = params.getArguments().get(2) instanceof JsonElement ? (JsonElement) params.getArguments().get(2) : GSON.toJsonTree(params.getArguments().get(2));
150150
TextEdit mainEdit = GSON.fromJson(editJson, TextEdit.class);
151-
if (isMagicIndentingClient()) {
152-
// Reverse sync edit magic client indentation. This indentation only works during completion application not command execution
153-
// The reversed edit text is needed to properly determine text to replace
154-
mainEdit.setNewText(revertVscodeIndentFix(server.getTextDocumentService().getLatestSnapshot(uri), mainEdit.getRange().getStart(), mainEdit.getNewText()));
155-
}
151+
// if (isMagicIndentingClient()) {
152+
// // Reverse sync edit magic client indentation. This indentation only works during completion application not command execution
153+
// // The reversed edit text is needed to properly determine text to replace
154+
// mainEdit.setNewText(revertVscodeIndentFix(server.getTextDocumentService().getLatestSnapshot(uri), mainEdit.getRange().getStart(), mainEdit.getNewText()));
155+
// }
156156

157157
return CompletableFuture.supplyAsync(() -> {
158158
CompletionItem unresolved = new CompletionItem(RESOLVE_EDIT_COMMAND);
@@ -465,9 +465,9 @@ private Optional<TextEdit> adaptEdits(TextDocument doc, DocumentEdits edits, Ato
465465
usedSnippets.set(true);
466466
}
467467
}
468-
if (isMagicIndentingClient() && !ignoreClientIndent) {
469-
newText = vscodeIndentFix(doc, vscodeEdit.getRange().getStart(), replaceEdit.newText);
470-
}
468+
// if (isMagicIndentingClient() && !ignoreClientIndent) {
469+
// newText = vscodeIndentFix(doc, vscodeEdit.getRange().getStart(), replaceEdit.newText);
470+
// }
471471
vscodeEdit.setNewText(newText);
472472
return Optional.of(vscodeEdit);
473473
}
@@ -480,9 +480,9 @@ private Optional<TextEdit> adaptEdits(TextDocument doc, DocumentEdits edits, Ato
480480
/**
481481
* When this is true, it means the client does 'magic indents' (basically.. that is only on vscode since the magics aren't part of the LSP spec).
482482
*/
483-
private boolean isMagicIndentingClient() {
484-
return !Boolean.getBoolean("lsp.completions.indentation.enable");
485-
}
483+
// private boolean isMagicIndentingClient() {
484+
// return !Boolean.getBoolean("lsp.completions.indentation.enable");
485+
// }
486486

487487
private static String vscodeIndentFix(TextDocument doc, Position start, String newText) {
488488
//Vscode applies some magic indent to a multi-line edit text. We do everything ourself so we have adjust for the magic

0 commit comments

Comments
 (0)