coc-springboot 0.0.3 → 0.0.6

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 +77 -22
  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);
@@ -3356,13 +3368,22 @@ var coc4 = __toESM(require("coc.nvim"));
3356
3368
  var path = __toESM(require("path"));
3357
3369
  var BOOT_UPGRADE = "BOOT_UPGRADE";
3358
3370
  var OTHER_REFACTORINGS = "NON_BOOT_UPGRADE";
3359
- var quickPick;
3360
3371
  var RECIPE_PICK_ACTIONS = [
3372
+ {
3373
+ id: "exit",
3374
+ label: "Close",
3375
+ description: "Exit the receipes picker without action",
3376
+ selected: false,
3377
+ picked: false,
3378
+ action: "exit",
3379
+ children: void 0
3380
+ },
3361
3381
  {
3362
3382
  id: "root",
3363
3383
  label: "Initial",
3364
3384
  description: "Navigate to the base list of receipes",
3365
3385
  selected: false,
3386
+ picked: false,
3366
3387
  action: "root",
3367
3388
  children: void 0
3368
3389
  },
@@ -3371,6 +3392,7 @@ var RECIPE_PICK_ACTIONS = [
3371
3392
  label: "Parent",
3372
3393
  description: "Navigate to the parent of this receipe",
3373
3394
  selected: false,
3395
+ picked: false,
3374
3396
  action: "parent",
3375
3397
  children: void 0
3376
3398
  }
@@ -3425,7 +3447,7 @@ async function showRefactorings(uri, filter) {
3425
3447
  if (recipeDescriptors.length) {
3426
3448
  coc4.commands.executeCommand("sts/rewrite/execute", uri.toString(true), recipeDescriptors, true);
3427
3449
  } else {
3428
- coc4.window.showErrorMessage("No recipes were selected from the list");
3450
+ coc4.window.showWarningMessage("No recipes were selected for application from the list");
3429
3451
  }
3430
3452
  }
3431
3453
  function convertToRecipeSelectionDescriptor(i) {
@@ -3446,14 +3468,13 @@ function convertToQuickPickItem(i, selected) {
3446
3468
  };
3447
3469
  }
3448
3470
  async function showCurrentPathQuickPick(itemsPromise, itemsPath) {
3449
- if (!quickPick) {
3450
- quickPick = await coc4.window.createQuickPick();
3451
- const columns = await coc4.nvim.eval("&columns");
3452
- quickPick.width = Math.ceil(columns * 0.7);
3453
- quickPick.matchOnDescription = true;
3454
- quickPick.canSelectMany = true;
3455
- }
3471
+ coc4.window.showInformationMessage("<tab> on item to toggle, <cr> for sub receipes list or action (close, initial, parent)");
3472
+ const quickPick = await coc4.window.createQuickPick();
3473
+ const columns = await coc4.nvim.eval("&columns");
3474
+ quickPick.width = Math.ceil(columns * 0.7);
3456
3475
  quickPick.title = "Loading Recipes";
3476
+ quickPick.matchOnDescription = true;
3477
+ quickPick.canSelectMany = true;
3457
3478
  quickPick.value = "";
3458
3479
  quickPick.items = [];
3459
3480
  quickPick.loading = true;
@@ -3471,15 +3492,15 @@ async function showCurrentPathQuickPick(itemsPromise, itemsPath) {
3471
3492
  if (itemsPath.length > 0) {
3472
3493
  currentItems = [...RECIPE_PICK_ACTIONS, ...currentItems];
3473
3494
  } else {
3474
- currentItems = [...currentItems];
3495
+ currentItems = [RECIPE_PICK_ACTIONS[0], ...currentItems];
3475
3496
  }
3476
3497
  setTimeout(() => {
3477
3498
  quickPick.title = "Select Recipes";
3478
3499
  quickPick.items = currentItems;
3479
3500
  quickPick.loading = false;
3480
- }, 175);
3501
+ }, 125);
3481
3502
  quickPick.onDidChangeSelection((selected) => {
3482
- if (selected.filter((i) => i.action === "root" || i.action === "parent").length > 0) {
3503
+ if (selected.filter((i) => !!i.action).length > 0) {
3483
3504
  return;
3484
3505
  }
3485
3506
  currentItems.forEach((i) => {
@@ -3492,14 +3513,16 @@ async function showCurrentPathQuickPick(itemsPromise, itemsPath) {
3492
3513
  });
3493
3514
  quickPick.onDidFinish((selectedItems) => {
3494
3515
  const index = quickPick.currIndex;
3495
- quickPick = null;
3496
- if (selectedItems && selectedItems.length > 0) {
3497
- resolve2(selectedItems);
3498
- coc4.window.showInformationMessage(`Applying ${selectedItems.length} items from the list of recipes `);
3516
+ const selected = selectedItems?.filter((i) => !i.action);
3517
+ if (selected && selected.length > 0) {
3518
+ resolve2(selected);
3519
+ coc4.window.showInformationMessage(`Applying ${selected.length} items from the list of recipes `);
3499
3520
  } else {
3500
3521
  if (index >= 0 && index < currentItems.length) {
3501
3522
  const item = currentItems[index];
3502
- if (item.action === "root") {
3523
+ if (item.action === "exit") {
3524
+ resolve2([]);
3525
+ } else if (item.action === "root") {
3503
3526
  showCurrentPathQuickPick(Promise.resolve(items), []).then(resolve2, reject);
3504
3527
  } else if (item.action === "parent") {
3505
3528
  itemsPath.pop();
@@ -3813,6 +3836,38 @@ function activate3(context) {
3813
3836
  return activate(options, context).then((client) => {
3814
3837
  import_coc6.commands.registerCommand("vscode-spring-boot.ls.start", () => client.start().then(() => {
3815
3838
  console.log(`Starting spring-boot server`);
3839
+ import_coc6.workspace.registerAutocmd({
3840
+ event: ["BufRead", "BufNewFile"],
3841
+ callback: async () => {
3842
+ await import_coc6.nvim.exec(`set ft=${YAML_LANGUAGE_ID}`);
3843
+ await import_coc6.nvim.exec("setl syntax=yaml");
3844
+ },
3845
+ pattern: "application*.yml,bootstrap*.yml,application*.yaml,bootstrap*.yaml"
3846
+ });
3847
+ import_coc6.workspace.registerAutocmd({
3848
+ event: ["BufRead", "BufNewFile"],
3849
+ callback: async () => {
3850
+ await import_coc6.nvim.exec(`set ft=${PROPERTIES_LANGUAGE_ID}`);
3851
+ await import_coc6.nvim.exec("setl syntax=jproperties");
3852
+ },
3853
+ pattern: "application*.properties,bootstrap*.properties"
3854
+ });
3855
+ import_coc6.workspace.registerAutocmd({
3856
+ event: ["BufRead", "BufNewFile"],
3857
+ callback: async () => {
3858
+ await import_coc6.nvim.exec(`set ft=${FACTORIES_LANGUAGE_ID}`);
3859
+ await import_coc6.nvim.exec("setl syntax=jproperties");
3860
+ },
3861
+ pattern: "spring*.factories"
3862
+ });
3863
+ import_coc6.workspace.registerAutocmd({
3864
+ event: ["BufRead", "BufNewFile"],
3865
+ callback: async () => {
3866
+ await import_coc6.nvim.exec(`set ft=${JPA_QUERY_PROPERTIES_LANGUAGE_ID}`);
3867
+ await import_coc6.nvim.exec("setl syntax=jproperties");
3868
+ },
3869
+ pattern: "jpa*.properties"
3870
+ });
3816
3871
  import_coc6.services.registerLanguageClient(client);
3817
3872
  registerClasspathService(client);
3818
3873
  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.6",
4
4
  "description": "Coc spring boot language server extension client",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",