coc-springboot 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/index.js +49 -5
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -3167,7 +3167,14 @@ function createServerOptionsForPortComm(location, options, context, jvm) {
3167
3167
  cwd: coc3.workspace.root
3168
3168
  };
3169
3169
  const args = prepareJvmArgs(location, options, context, jvm, port);
3170
- if (options.explodedLsJarData) {
3170
+ const launcher = findServerJar(Path.resolve(location, "language-server"));
3171
+ if (!launcher) {
3172
+ logToSpringBootOutput(`Unable to locate language server jars under working directory ${location}, falling back to exploded jar resolution`);
3173
+ options.explodedLsJarData = {
3174
+ lsLocation: "language-server",
3175
+ configFileName: "application.properties",
3176
+ mainClass: "org.springframework.ide.vscode.boot.app.BootLanguageServerBootApp"
3177
+ };
3171
3178
  const explodedLsJarData = options.explodedLsJarData;
3172
3179
  const lsRoot = Path.resolve(location, explodedLsJarData.lsLocation);
3173
3180
  const classpath = [];
@@ -3175,7 +3182,6 @@ function createServerOptionsForPortComm(location, options, context, jvm) {
3175
3182
  classpath.push(`${Path.resolve(lsRoot, "BOOT-INF/lib")}${Path.sep}*`);
3176
3183
  jvm.mainClassLaunch(explodedLsJarData.mainClass, classpath, args, processLaunchoptions);
3177
3184
  } else {
3178
- const launcher = findServerJar(Path.resolve(location, "language-server"));
3179
3185
  jvm.jarLaunch(launcher, args, processLaunchoptions);
3180
3186
  }
3181
3187
  });
@@ -3225,7 +3231,14 @@ function prepareJvmArgs(location, options, context, jvm, port) {
3225
3231
  return args;
3226
3232
  }
3227
3233
  function addCpAndLauncherToJvmArgs(location, args, options, context) {
3228
- if (options.explodedLsJarData) {
3234
+ const launcher = findServerJar(Path.resolve(location, "language-server"));
3235
+ if (!launcher) {
3236
+ logToSpringBootOutput(`Unable to locate language server jars under working directory ${location}, falling back to exploded jar resolution`);
3237
+ options.explodedLsJarData = {
3238
+ lsLocation: "language-server",
3239
+ configFileName: "application.properties",
3240
+ mainClass: "org.springframework.ide.vscode.boot.app.BootLanguageServerBootApp"
3241
+ };
3229
3242
  const explodedLsJarData = options.explodedLsJarData;
3230
3243
  const lsRoot = Path.resolve(location, explodedLsJarData.lsLocation);
3231
3244
  const classpath = [];
@@ -3236,7 +3249,6 @@ function addCpAndLauncherToJvmArgs(location, args, options, context) {
3236
3249
  args.push(explodedLsJarData.mainClass);
3237
3250
  } else {
3238
3251
  args.push("-jar");
3239
- const launcher = findServerJar(Path.resolve(location, "language-server"));
3240
3252
  args.push(launcher);
3241
3253
  }
3242
3254
  }
@@ -3254,7 +3266,7 @@ function findServerJar(jarsDir) {
3254
3266
  (jar) => jar.indexOf("language-server") >= 0 && jar.endsWith(".jar")
3255
3267
  );
3256
3268
  if (serverJars.length == 0) {
3257
- throw new Error("Server jar not found in " + jarsDir);
3269
+ return void 0;
3258
3270
  }
3259
3271
  if (serverJars.length > 1) {
3260
3272
  throw new Error("Multiple server jars found in " + jarsDir);
@@ -3813,6 +3825,38 @@ function activate3(context) {
3813
3825
  return activate(options, context).then((client) => {
3814
3826
  import_coc6.commands.registerCommand("vscode-spring-boot.ls.start", () => client.start().then(() => {
3815
3827
  console.log(`Starting spring-boot server`);
3828
+ import_coc6.workspace.registerAutocmd({
3829
+ event: ["BufRead", "BufNewFile"],
3830
+ callback: async () => {
3831
+ await import_coc6.nvim.exec(`set ft=${YAML_LANGUAGE_ID}`);
3832
+ await import_coc6.nvim.exec("setl syntax=yaml");
3833
+ },
3834
+ pattern: "application*.yml,bootstrap*.yml,application*.yaml,bootstrap*.yaml"
3835
+ });
3836
+ import_coc6.workspace.registerAutocmd({
3837
+ event: ["BufRead", "BufNewFile"],
3838
+ callback: async () => {
3839
+ await import_coc6.nvim.exec(`set ft=${PROPERTIES_LANGUAGE_ID}`);
3840
+ await import_coc6.nvim.exec("setl syntax=jproperties");
3841
+ },
3842
+ pattern: "application*.properties,bootstrap*.properties"
3843
+ });
3844
+ import_coc6.workspace.registerAutocmd({
3845
+ event: ["BufRead", "BufNewFile"],
3846
+ callback: async () => {
3847
+ await import_coc6.nvim.exec(`set ft=${FACTORIES_LANGUAGE_ID}`);
3848
+ await import_coc6.nvim.exec("setl syntax=jproperties");
3849
+ },
3850
+ pattern: "spring*.factories"
3851
+ });
3852
+ import_coc6.workspace.registerAutocmd({
3853
+ event: ["BufRead", "BufNewFile"],
3854
+ callback: async () => {
3855
+ await import_coc6.nvim.exec(`set ft=${JPA_QUERY_PROPERTIES_LANGUAGE_ID}`);
3856
+ await import_coc6.nvim.exec("setl syntax=jproperties");
3857
+ },
3858
+ pattern: "jpa*.properties"
3859
+ });
3816
3860
  import_coc6.services.registerLanguageClient(client);
3817
3861
  registerClasspathService(client);
3818
3862
  registerJavaDataService(client);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coc-springboot",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "Coc spring boot language server extension client",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",