Attempt to fix 'trigger characters' issue.

- modify textmate grammars so that interesting contexts count
  as 'identifiers'.
- disable trigger chars on vscode

The effect of this is that vscode auto-triggers completions even
without trigger characters.
This commit is contained in:
Kris De Volder
2019-03-25 10:17:54 -07:00
parent aa45fdc79c
commit fb3f610c19
4 changed files with 37 additions and 29 deletions

View File

@@ -99,7 +99,20 @@ public class CloudFoundryManifestLanguageServer extends STS4LanguageServerProces
File dataFile = bundle.getDataFile(languageServerLocalCopy);
Exception error = null;
if (!dataFile.exists() || bundleVersion.endsWith("qualifier")) { // qualifier check to get the language server always copied in dev mode
if (bundleVersion.endsWith("qualifier")) {
File userHome = new File(System.getProperty("user.home"));
File locallyBuiltJar = new File(
userHome,
"git/sts4/headless-services/manifest-yaml-language-server/target/manifest-yaml-language-server-"+Constants.LANGUAGE_SERVER_VERSION
);
if (locallyBuiltJar.exists()) {
return locallyBuiltJar.getAbsolutePath();
} else {
throw new IllegalStateException("Not found language server jar: "+locallyBuiltJar);
}
}
if (!dataFile.exists()) {
try {
copyLanguageServerJAR(languageServer, languageServerLocalCopy);
}
@@ -108,14 +121,6 @@ public class CloudFoundryManifestLanguageServer extends STS4LanguageServerProces
}
}
if (!dataFile.exists()) {
File userHome = new File(System.getProperty("user.home"));
File locallyBuiltJar = new File(
userHome,
"git/sts4/headless-services/manifest-yaml-language-server/target/manifest-yaml-language-server-"+Constants.LANGUAGE_SERVER_VERSION
);
if (locallyBuiltJar.exists()) {
return locallyBuiltJar.getAbsolutePath();
}
if (error!=null) {
error.printStackTrace();
}

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
@@ -73,14 +73,14 @@
<key>2</key>
<dict>
<key>name</key>
<string>support.constant.java-properties</string>
<string>support.identifier.java-properties</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\(?:[ \t:=\\ntfr\"']|u[0-9A-Fa-f]{4})</string>
<key>name</key>
<string>constant.character.escape.java-properties</string>
<string>identifier.character.escape.java-properties</string>
</dict>
</array>
</dict>
@@ -116,7 +116,7 @@
<key>match</key>
<string>\\(?:[\\ntfr\"']|u[0-9A-Fa-f]{4})</string>
<key>name</key>
<string>constant.character.escape.java-properties</string>
<string>identifier.character.escape.java-properties</string>
</dict>
</array>
</dict>
@@ -132,14 +132,14 @@
<key>2</key>
<dict>
<key>name</key>
<string>support.constant.java-properties</string>
<string>support.identifier.java-properties</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\(?:[ \t:=\\ntfr\"']|u[0-9A-Fa-f]{4})</string>
<key>name</key>
<string>constant.character.escape.java-properties</string>
<string>identifier.character.escape.java-properties</string>
</dict>
</array>
</dict>

View File

@@ -9,7 +9,10 @@ npm install ../commons-vscode/*-commons-vscode-*.tgz
# Copy grammar files for .properties and .yml format
curl https://raw.githubusercontent.com/textmate/yaml.tmbundle/master/Syntaxes/YAML.tmLanguage > yaml-support/yaml.tmLanguage
sed -i -e 's/string\./identifier\./g' yaml-support/yaml.tmLanguage
curl https://raw.githubusercontent.com/textmate/java.tmbundle/master/Syntaxes/JavaProperties.plist > properties-support/java-properties.tmLanguage
sed -i -e 's/constant/identifier/g' properties-support/java-properties.tmLanguage
# Clean old jars
rm -fr ${workdir}/jars

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
@@ -199,7 +199,7 @@
)
</string>
<key>name</key>
<string>string.unquoted.plain.out.yaml</string>
<string>identifier.unquoted.plain.out.yaml</string>
</dict>
</array>
</dict>
@@ -264,7 +264,7 @@
<key>end</key>
<string>^(?!\1|\s*$)</string>
<key>name</key>
<string>string.unquoted.block.yaml</string>
<string>identifier.unquoted.block.yaml</string>
</dict>
</array>
</dict>
@@ -388,12 +388,12 @@
<key>2</key>
<dict>
<key>name</key>
<string>string.unquoted.directive-name.yaml</string>
<string>identifier.unquoted.directive-name.yaml</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>string.unquoted.directive-parameter.yaml</string>
<string>identifier.unquoted.directive-parameter.yaml</string>
</dict>
</dict>
<key>match</key>
@@ -632,7 +632,7 @@
)
</string>
<key>name</key>
<string>string.unquoted.plain.in.yaml</string>
<string>identifier.unquoted.plain.in.yaml</string>
</dict>
</array>
</dict>
@@ -692,7 +692,7 @@
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.yaml</string>
<string>punctuation.definition.identifier.begin.yaml</string>
</dict>
</dict>
<key>end</key>
@@ -702,11 +702,11 @@
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.yaml</string>
<string>punctuation.definition.identifier.end.yaml</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.double.yaml</string>
<string>identifier.quoted.double.yaml</string>
<key>patterns</key>
<array>
<dict>
@@ -748,7 +748,7 @@
)
</string>
<key>name</key>
<string>string.unquoted.plain.in.yaml</string>
<string>identifier.unquoted.plain.in.yaml</string>
</dict>
</array>
</dict>
@@ -872,7 +872,7 @@
)
</string>
<key>name</key>
<string>string.unquoted.plain.out.yaml</string>
<string>identifier.unquoted.plain.out.yaml</string>
</dict>
</array>
</dict>
@@ -980,7 +980,7 @@
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.yaml</string>
<string>punctuation.definition.identifier.begin.yaml</string>
</dict>
</dict>
<key>end</key>
@@ -990,11 +990,11 @@
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.yaml</string>
<string>punctuation.definition.identifier.end.yaml</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.single.yaml</string>
<string>identifier.quoted.single.yaml</string>
<key>patterns</key>
<array>
<dict>