From 4b0db9ced3375160f2ac3cc29f1d9a276e9550d9 Mon Sep 17 00:00:00 2001 From: angelozerr Date: Fri, 2 Nov 2018 11:48:14 +0100 Subject: [PATCH] Disable snippet in code action (see #185) --- .../codeactions/cvc_complex_type_2_1CodeAction.java | 2 +- .../codeactions/cvc_complex_type_4CodeAction.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/contentmodel/participants/codeactions/cvc_complex_type_2_1CodeAction.java b/org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/contentmodel/participants/codeactions/cvc_complex_type_2_1CodeAction.java index 665ed3aeef..404d748cd5 100644 --- a/org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/contentmodel/participants/codeactions/cvc_complex_type_2_1CodeAction.java +++ b/org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/contentmodel/participants/codeactions/cvc_complex_type_2_1CodeAction.java @@ -47,7 +47,7 @@ public void doCodeAction(Diagnostic diagnostic, Range range, XMLDocument documen } } catch (BadLocationException e) { - // DO nothing + // Do nothing } } diff --git a/org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/contentmodel/participants/codeactions/cvc_complex_type_4CodeAction.java b/org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/contentmodel/participants/codeactions/cvc_complex_type_4CodeAction.java index 2b7af2e471..547bcab123 100644 --- a/org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/contentmodel/participants/codeactions/cvc_complex_type_4CodeAction.java +++ b/org.eclipse.lsp4xml/src/main/java/org/eclipse/lsp4xml/extensions/contentmodel/participants/codeactions/cvc_complex_type_4CodeAction.java @@ -28,7 +28,7 @@ import org.eclipse.lsp4xml.settings.XMLFormattingOptions; /** - * Code action to fix cvc-complex-type.2.3 error. + * Code action to fix cvc-complex-type.4 error. * */ public class cvc_complex_type_4CodeAction implements ICodeActionParticipant { @@ -54,7 +54,9 @@ public void doCodeAction(Diagnostic diagnostic, Range range, XMLDocument documen .filter(cmAttr -> !element.hasAttribute(cmAttr.getName())) // .collect(Collectors.toList()); - XMLGenerator generator = new XMLGenerator(null, "", "", true, 0); + // CodeAction doesn't support snippet -> https://github.com/Microsoft/language-server-protocol/issues/592 + boolean supportSnippet = false; + XMLGenerator generator = new XMLGenerator(null, "", "", supportSnippet, 0); String xmlAttributes = generator.generate(requiredAttributes, element.getTagName()); // Insert required attributes