@eclipse-glsp/client 2.6.0-next.1 → 2.6.0-next.11

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 (179) hide show
  1. package/css/command-palette.css +2 -0
  2. package/css/navigation.css +2 -2
  3. package/css/search.css +12 -3
  4. package/lib/base/action-dispatcher.d.ts +7 -1
  5. package/lib/base/action-dispatcher.d.ts.map +1 -1
  6. package/lib/base/action-dispatcher.js +82 -15
  7. package/lib/base/action-dispatcher.js.map +1 -1
  8. package/lib/base/auto-complete/auto-complete-widget.d.ts +2 -2
  9. package/lib/base/auto-complete/auto-complete-widget.d.ts.map +1 -1
  10. package/lib/base/auto-complete/auto-complete-widget.js +5 -2
  11. package/lib/base/auto-complete/auto-complete-widget.js.map +1 -1
  12. package/lib/base/auto-complete/autocomplete-suggestion-provider.d.ts +56 -0
  13. package/lib/base/auto-complete/autocomplete-suggestion-provider.d.ts.map +1 -0
  14. package/lib/base/auto-complete/autocomplete-suggestion-provider.js +56 -0
  15. package/lib/base/auto-complete/autocomplete-suggestion-provider.js.map +1 -0
  16. package/lib/base/auto-complete/base-autocomplete-palette.d.ts +4 -9
  17. package/lib/base/auto-complete/base-autocomplete-palette.d.ts.map +1 -1
  18. package/lib/base/auto-complete/base-autocomplete-palette.js +2 -2
  19. package/lib/base/auto-complete/base-autocomplete-palette.js.map +1 -1
  20. package/lib/base/default.module.d.ts.map +1 -1
  21. package/lib/base/default.module.js +4 -0
  22. package/lib/base/default.module.js.map +1 -1
  23. package/lib/base/messages.json +68 -57
  24. package/lib/base/tool-manager/tool-manager.d.ts +2 -2
  25. package/lib/base/tool-manager/tool-manager.d.ts.map +1 -1
  26. package/lib/base/tool-manager/tool-manager.js +4 -4
  27. package/lib/base/tool-manager/tool-manager.js.map +1 -1
  28. package/lib/default-modules.d.ts +1 -1
  29. package/lib/default-modules.d.ts.map +1 -1
  30. package/lib/default-modules.js +4 -1
  31. package/lib/default-modules.js.map +1 -1
  32. package/lib/features/accessibility/accessibility-module.d.ts.map +1 -1
  33. package/lib/features/accessibility/accessibility-module.js +2 -4
  34. package/lib/features/accessibility/accessibility-module.js.map +1 -1
  35. package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-palette.d.ts +21 -15
  36. package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-palette.d.ts.map +1 -1
  37. package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-palette.js +59 -45
  38. package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-palette.js.map +1 -1
  39. package/lib/features/accessibility/element-navigation/diagram-navigation-tool.d.ts.map +1 -1
  40. package/lib/features/accessibility/element-navigation/diagram-navigation-tool.js +2 -3
  41. package/lib/features/accessibility/element-navigation/diagram-navigation-tool.js.map +1 -1
  42. package/lib/features/accessibility/{keyboard-pointer/keyboard-pointer-module.d.ts → keyboard/keyboard-module.d.ts} +2 -2
  43. package/lib/features/accessibility/keyboard/keyboard-module.d.ts.map +1 -0
  44. package/lib/features/accessibility/{keyboard-pointer/keyboard-pointer-module.js → keyboard/keyboard-module.js} +7 -4
  45. package/lib/features/accessibility/keyboard/keyboard-module.js.map +1 -0
  46. package/lib/features/accessibility/keyboard-grid/keyboard-grid-search-palette.d.ts +15 -12
  47. package/lib/features/accessibility/keyboard-grid/keyboard-grid-search-palette.d.ts.map +1 -1
  48. package/lib/features/accessibility/keyboard-grid/keyboard-grid-search-palette.js +40 -22
  49. package/lib/features/accessibility/keyboard-grid/keyboard-grid-search-palette.js.map +1 -1
  50. package/lib/features/accessibility/keyboard-grid/keyboard-node-grid.d.ts +1 -1
  51. package/lib/features/accessibility/keyboard-grid/keyboard-node-grid.js +2 -2
  52. package/lib/features/accessibility/keyboard-grid/keyboard-node-grid.js.map +1 -1
  53. package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts +1 -1
  54. package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts.map +1 -1
  55. package/lib/features/bounds/glsp-hidden-bounds-updater.js +4 -1
  56. package/lib/features/bounds/glsp-hidden-bounds-updater.js.map +1 -1
  57. package/lib/features/change-bounds/movement-restrictor.d.ts +12 -4
  58. package/lib/features/change-bounds/movement-restrictor.d.ts.map +1 -1
  59. package/lib/features/change-bounds/movement-restrictor.js +44 -17
  60. package/lib/features/change-bounds/movement-restrictor.js.map +1 -1
  61. package/lib/features/command-palette/command-palette.d.ts +3 -1
  62. package/lib/features/command-palette/command-palette.d.ts.map +1 -1
  63. package/lib/features/command-palette/command-palette.js +37 -0
  64. package/lib/features/command-palette/command-palette.js.map +1 -1
  65. package/lib/features/context-menu/delete-element-context-menu.d.ts +4 -4
  66. package/lib/features/context-menu/delete-element-context-menu.d.ts.map +1 -1
  67. package/lib/features/context-menu/delete-element-context-menu.js +6 -2
  68. package/lib/features/context-menu/delete-element-context-menu.js.map +1 -1
  69. package/lib/features/context-menu/server-context-menu-provider.d.ts +4 -4
  70. package/lib/features/context-menu/server-context-menu-provider.d.ts.map +1 -1
  71. package/lib/features/context-menu/server-context-menu-provider.js +4 -5
  72. package/lib/features/context-menu/server-context-menu-provider.js.map +1 -1
  73. package/lib/features/copy-paste/copy-paste-context-menu.d.ts +22 -5
  74. package/lib/features/copy-paste/copy-paste-context-menu.d.ts.map +1 -1
  75. package/lib/features/copy-paste/copy-paste-context-menu.js +16 -11
  76. package/lib/features/copy-paste/copy-paste-context-menu.js.map +1 -1
  77. package/lib/features/decoration/decoration-module.d.ts +1 -1
  78. package/lib/features/decoration/decoration-module.d.ts.map +1 -1
  79. package/lib/features/decoration/decoration-module.js +2 -1
  80. package/lib/features/decoration/decoration-module.js.map +1 -1
  81. package/lib/features/decoration/decoration-placer.d.ts +9 -3
  82. package/lib/features/decoration/decoration-placer.d.ts.map +1 -1
  83. package/lib/features/decoration/decoration-placer.js +32 -1
  84. package/lib/features/decoration/decoration-placer.js.map +1 -1
  85. package/{src/features/accessibility/edge-autocomplete/edge-autocomplete-context.ts → lib/features/search-palette/search-palette-key-listener.d.ts} +5 -9
  86. package/lib/features/search-palette/search-palette-key-listener.d.ts.map +1 -0
  87. package/lib/features/search-palette/search-palette-key-listener.js +45 -0
  88. package/lib/features/search-palette/search-palette-key-listener.js.map +1 -0
  89. package/lib/features/{accessibility/search → search-palette}/search-palette-module.d.ts +4 -3
  90. package/lib/features/search-palette/search-palette-module.d.ts.map +1 -0
  91. package/lib/features/search-palette/search-palette-module.js +39 -0
  92. package/lib/features/search-palette/search-palette-module.js.map +1 -0
  93. package/lib/features/search-palette/search-palette.d.ts +51 -0
  94. package/lib/features/search-palette/search-palette.d.ts.map +1 -0
  95. package/lib/features/search-palette/search-palette.js +141 -0
  96. package/lib/features/search-palette/search-palette.js.map +1 -0
  97. package/{src/base/auto-complete/autocomplete-suggestion-providers.ts → lib/features/search-palette/suggestions/edge-element-suggestions.d.ts} +11 -22
  98. package/lib/features/search-palette/suggestions/edge-element-suggestions.d.ts.map +1 -0
  99. package/lib/features/search-palette/suggestions/edge-element-suggestions.js +72 -0
  100. package/lib/features/search-palette/suggestions/edge-element-suggestions.js.map +1 -0
  101. package/lib/features/search-palette/suggestions/named-element-suggestions.d.ts +30 -0
  102. package/lib/features/search-palette/suggestions/named-element-suggestions.d.ts.map +1 -0
  103. package/lib/features/search-palette/suggestions/named-element-suggestions.js +83 -0
  104. package/lib/features/search-palette/suggestions/named-element-suggestions.js.map +1 -0
  105. package/lib/features/validation/marker-navigator.d.ts +3 -3
  106. package/lib/features/validation/marker-navigator.d.ts.map +1 -1
  107. package/lib/features/validation/marker-navigator.js +8 -7
  108. package/lib/features/validation/marker-navigator.js.map +1 -1
  109. package/lib/features/viewport/reposition.d.ts.map +1 -1
  110. package/lib/features/viewport/reposition.js +1 -5
  111. package/lib/features/viewport/reposition.js.map +1 -1
  112. package/lib/index.d.ts +7 -6
  113. package/lib/index.d.ts.map +1 -1
  114. package/lib/index.js +7 -6
  115. package/lib/index.js.map +1 -1
  116. package/lib/standalone-modules.d.ts +1 -1
  117. package/lib/standalone-modules.d.ts.map +1 -1
  118. package/lib/standalone-modules.js +2 -0
  119. package/lib/standalone-modules.js.map +1 -1
  120. package/lib/utils/gmodel-util.d.ts +32 -2
  121. package/lib/utils/gmodel-util.d.ts.map +1 -1
  122. package/lib/utils/gmodel-util.js +29 -1
  123. package/lib/utils/gmodel-util.js.map +1 -1
  124. package/package.json +3 -3
  125. package/src/base/action-dispatcher.ts +88 -15
  126. package/src/base/auto-complete/auto-complete-widget.ts +7 -4
  127. package/src/base/auto-complete/autocomplete-suggestion-provider.ts +86 -0
  128. package/src/base/auto-complete/base-autocomplete-palette.ts +6 -6
  129. package/src/base/default.module.ts +5 -0
  130. package/src/base/messages.json +68 -57
  131. package/src/base/tool-manager/tool-manager.ts +4 -4
  132. package/src/default-modules.ts +4 -1
  133. package/src/features/accessibility/accessibility-module.ts +1 -3
  134. package/src/features/accessibility/edge-autocomplete/edge-autocomplete-palette.ts +75 -52
  135. package/src/features/accessibility/element-navigation/diagram-navigation-tool.ts +2 -4
  136. package/src/features/accessibility/{keyboard-pointer/keyboard-pointer-module.ts → keyboard/keyboard-module.ts} +12 -5
  137. package/src/features/accessibility/keyboard-grid/keyboard-grid-search-palette.ts +36 -22
  138. package/src/features/accessibility/keyboard-grid/keyboard-node-grid.ts +3 -3
  139. package/src/features/bounds/glsp-hidden-bounds-updater.ts +5 -1
  140. package/src/features/change-bounds/movement-restrictor.ts +72 -19
  141. package/src/features/command-palette/command-palette.ts +41 -1
  142. package/src/features/context-menu/delete-element-context-menu.ts +9 -5
  143. package/src/features/context-menu/server-context-menu-provider.ts +8 -9
  144. package/src/features/copy-paste/copy-paste-context-menu.ts +21 -17
  145. package/src/features/decoration/decoration-module.ts +2 -1
  146. package/src/features/decoration/decoration-placer.ts +49 -4
  147. package/src/features/{accessibility/search/search-palette-module.ts → search-palette/search-palette-key-listener.ts} +15 -14
  148. package/src/features/search-palette/search-palette-module.ts +48 -0
  149. package/src/features/search-palette/search-palette.ts +164 -0
  150. package/src/features/search-palette/suggestions/edge-element-suggestions.ts +71 -0
  151. package/src/features/search-palette/suggestions/named-element-suggestions.ts +88 -0
  152. package/src/features/validation/marker-navigator.ts +9 -8
  153. package/src/features/viewport/reposition.ts +1 -7
  154. package/src/index.ts +7 -6
  155. package/src/standalone-modules.ts +2 -0
  156. package/src/utils/gmodel-util.ts +59 -1
  157. package/lib/base/auto-complete/autocomplete-suggestion-providers.d.ts +0 -35
  158. package/lib/base/auto-complete/autocomplete-suggestion-providers.d.ts.map +0 -1
  159. package/lib/base/auto-complete/autocomplete-suggestion-providers.js +0 -18
  160. package/lib/base/auto-complete/autocomplete-suggestion-providers.js.map +0 -1
  161. package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-context.d.ts +0 -23
  162. package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-context.d.ts.map +0 -1
  163. package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-context.js +0 -18
  164. package/lib/features/accessibility/edge-autocomplete/edge-autocomplete-context.js.map +0 -1
  165. package/lib/features/accessibility/keyboard-pointer/keyboard-pointer-module.d.ts.map +0 -1
  166. package/lib/features/accessibility/keyboard-pointer/keyboard-pointer-module.js.map +0 -1
  167. package/lib/features/accessibility/search/search-palette-module.d.ts.map +0 -1
  168. package/lib/features/accessibility/search/search-palette-module.js +0 -32
  169. package/lib/features/accessibility/search/search-palette-module.js.map +0 -1
  170. package/lib/features/accessibility/search/search-palette.d.ts +0 -51
  171. package/lib/features/accessibility/search/search-palette.d.ts.map +0 -1
  172. package/lib/features/accessibility/search/search-palette.js +0 -186
  173. package/lib/features/accessibility/search/search-palette.js.map +0 -1
  174. package/lib/features/accessibility/search/search-tool.d.ts +0 -33
  175. package/lib/features/accessibility/search/search-tool.d.ts.map +0 -1
  176. package/lib/features/accessibility/search/search-tool.js +0 -84
  177. package/lib/features/accessibility/search/search-tool.js.map +0 -1
  178. package/src/features/accessibility/search/search-palette.ts +0 -218
  179. package/src/features/accessibility/search/search-tool.ts +0 -74
@@ -21,7 +21,8 @@ import {
21
21
  ValidationStatus,
22
22
  codiconCSSClasses,
23
23
  matchesKeystroke,
24
- toArray
24
+ toArray,
25
+ type MaybePromise
25
26
  } from '@eclipse-glsp/sprotty';
26
27
  import { AutocompleteResult, AutocompleteSettings } from 'autocompleter';
27
28
  import { AutoCompleteValue } from './auto-complete-actions';
@@ -48,7 +49,7 @@ export interface InputValueInitializer {
48
49
  }
49
50
 
50
51
  export interface SuggestionSubmitHandler {
51
- executeFromSuggestion(input: LabeledAction | Action | Action[]): void;
52
+ executeFromSuggestion(input: LabeledAction | Action | Action[]): MaybePromise<void>;
52
53
  }
53
54
 
54
55
  export interface TextSubmitHandler {
@@ -303,8 +304,9 @@ export class AutoCompleteWidget {
303
304
  // trigger update of suggestions with an keyup event
304
305
  window.setTimeout(() => this.inputElement.dispatchEvent(new Event('input')));
305
306
  } else {
306
- this.executeFromSuggestion(item);
307
- this.notifyClose('submission');
307
+ Promise.resolve(this.executeFromSuggestion(item)).then(() => {
308
+ this.notifyClose('submission');
309
+ });
308
310
  }
309
311
  }
310
312
 
@@ -362,6 +364,7 @@ export class AutoCompleteWidget {
362
364
  if (this.autoCompleteResult) {
363
365
  this.autoCompleteResult.destroy();
364
366
  }
367
+ this.observer?.disconnect();
365
368
  }
366
369
  }
367
370
 
@@ -0,0 +1,86 @@
1
+ /********************************************************************************
2
+ * Copyright (c) 2023-2025 Business Informatics Group (TU Wien) and others.
3
+ *
4
+ * This program and the accompanying materials are made available under the
5
+ * terms of the Eclipse Public License v. 2.0 which is available at
6
+ * http://www.eclipse.org/legal/epl-2.0.
7
+ *
8
+ * This Source Code may also be made available under the following Secondary
9
+ * Licenses when the conditions for such availability set forth in the Eclipse
10
+ * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ * with the GNU Classpath Exception which is available at
12
+ * https://www.gnu.org/software/classpath/license.html.
13
+ *
14
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+
17
+ import {
18
+ GModelRoot,
19
+ InstanceRegistry,
20
+ LazyInjector,
21
+ TYPES,
22
+ type GModelElement,
23
+ type LabeledAction,
24
+ type MaybePromise
25
+ } from '@eclipse-glsp/sprotty';
26
+ import { inject, injectable } from 'inversify';
27
+
28
+ /**
29
+ * Interface for autocomplete suggestions.
30
+ */
31
+ export interface AutocompleteSuggestion {
32
+ element?: GModelElement;
33
+ action: LabeledAction;
34
+ }
35
+
36
+ /**
37
+ * A provider for autocomplete suggestions.
38
+ */
39
+ export interface IAutocompleteSuggestionProvider {
40
+ id: string;
41
+
42
+ /**
43
+ * Returns whether this provider can handle the given autocomplete context.
44
+ * @param context The context to check.
45
+ */
46
+ canHandle(context: string): boolean;
47
+
48
+ /**
49
+ * Provides suggestions for the given input
50
+ */
51
+ getSuggestions(root: Readonly<GModelRoot>, text: string, context?: unknown): Promise<AutocompleteSuggestion[]>;
52
+ }
53
+
54
+ /**
55
+ * Default contexts for autocomplete suggestions.
56
+ */
57
+ export namespace AutocompleteSuggestionProviderContext {
58
+ export const CANVAS = 'canvas' as const;
59
+ }
60
+
61
+ /**
62
+ * Registry for autocomplete suggestion providers.
63
+ */
64
+ export interface AutocompleteSuggestionRegistry extends InstanceRegistry<IAutocompleteSuggestionProvider> {
65
+ providersForContext(context: string[]): IAutocompleteSuggestionProvider[];
66
+ }
67
+
68
+ @injectable()
69
+ export class DefaultAutocompleteSuggestionRegistry
70
+ extends InstanceRegistry<IAutocompleteSuggestionProvider>
71
+ implements AutocompleteSuggestionRegistry
72
+ {
73
+ @inject(LazyInjector)
74
+ protected lazyInjector: LazyInjector;
75
+
76
+ preLoadDiagram(): MaybePromise<void> {
77
+ const suggestionProviders = this.lazyInjector.getAll<IAutocompleteSuggestionProvider>(TYPES.IAutocompleteSuggestionProvider);
78
+ suggestionProviders.forEach(provider => {
79
+ this.register(provider.id, provider);
80
+ });
81
+ }
82
+
83
+ providersForContext(searchContext: string[]): IAutocompleteSuggestionProvider[] {
84
+ return Array.from(this.elements.values()).filter(provider => searchContext.some(c => provider.canHandle(c)));
85
+ }
86
+ }
@@ -14,12 +14,12 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
 
17
- import { Action, GModelRoot, IActionDispatcher, LabeledAction, TYPES } from '@eclipse-glsp/sprotty';
17
+ import { Action, GModelRoot, IActionDispatcher, LabeledAction, TYPES, type MaybePromise } from '@eclipse-glsp/sprotty';
18
18
  import { inject } from 'inversify';
19
19
  import '../../../css/autocomplete-palette.css';
20
- import { GLSPAbstractUIExtension } from '../ui-extension/ui-extension';
21
- import { AutoCompleteWidget, CloseReason, toActionArray } from './auto-complete-widget';
22
20
  import { messages } from '../messages';
21
+ import { GLSPAbstractUIExtension } from '../ui-extension/ui-extension';
22
+ import { AutoCompleteWidget, CloseReason, toActionArray, type AutoCompleteSettings } from './auto-complete-widget';
23
23
 
24
24
  /**
25
25
  * A reusable base implementation for `UIExtensions` that want to provide autocomplete functionality
@@ -27,7 +27,7 @@ import { messages } from '../messages';
27
27
  *
28
28
  */
29
29
  export abstract class BaseAutocompletePalette extends GLSPAbstractUIExtension {
30
- protected readonly autoSuggestionSettings = {
30
+ protected readonly autoSuggestionSettings: AutoCompleteSettings = {
31
31
  noSuggestionsMessage: messages.autocomplete.no_suggestions,
32
32
  suggestionsClass: 'command-palette-suggestions',
33
33
  debounceWaitMs: 50,
@@ -87,7 +87,7 @@ export abstract class BaseAutocompletePalette extends GLSPAbstractUIExtension {
87
87
  this.hide();
88
88
  }
89
89
 
90
- protected executeSuggestion(input: LabeledAction | Action[] | Action): void {
91
- this.actionDispatcher.dispatchAll(toActionArray(input));
90
+ protected executeSuggestion(input: LabeledAction | Action[] | Action): MaybePromise<void> {
91
+ return this.actionDispatcher.dispatchAll(toActionArray(input));
92
92
  }
93
93
  }
@@ -36,6 +36,7 @@ import '@vscode/codicons/dist/codicon.css';
36
36
  import '../../css/glsp-sprotty.css';
37
37
  import { GLSPActionDispatcher } from './action-dispatcher';
38
38
  import { GLSPActionHandlerRegistry } from './action-handler-registry';
39
+ import { DefaultAutocompleteSuggestionRegistry } from './auto-complete/autocomplete-suggestion-provider';
39
40
  import { GLSPCommandStack } from './command-stack';
40
41
  import { EditorContextService } from './editor-context-service';
41
42
  import { ModifyCssFeedbackCommand } from './feedback/css-feedback';
@@ -148,6 +149,10 @@ export const defaultModule = new FeatureModule(
148
149
 
149
150
  // Shortcut manager initialization ------------------------------------
150
151
  bindAsService(context, TYPES.IShortcutManager, ShortcutManager);
152
+
153
+ // Autocomplete suggestion provider initialization ------------------------------------
154
+ bind(TYPES.IAutocompleteSuggestionProviderRegistry).to(DefaultAutocompleteSuggestionRegistry).inSingletonScope();
155
+ bind(TYPES.IDiagramStartup).toService(TYPES.IAutocompleteSuggestionProviderRegistry);
151
156
  },
152
157
  {
153
158
  featureId: Symbol('default')
@@ -1,87 +1,98 @@
1
1
  {
2
- "navigation": {
3
- "default_navigation_mode_activated": "Navigation On: Use arrow keys to select preceding (←) or succeding (→) elements. Use the up (↑) and down (↓) arrows to navigate paths. Press 'N' to exit.",
4
- "default_navigation_mode_deactivated": "Navigation Off: Press 'N' for default navigation, 'ALT+N' for position based navigation.",
5
- "local_navigation_mode_activated": "Position based Nav On: Navigate nearest elements using arrow keys: (↑) for above, (↓) for below, (←) for previous, (→) for next element. Press 'ALT+N' to exit.",
6
- "local_navigation_mode_deactivated": "Position based Nav Off: Press 'N' for default navigation, 'ALT+N' for position based navigation.",
7
- "shortcut_local_mode": "Activate local navigation mode",
8
- "shortcut_global_mode": "Activate global navigation mode"
2
+ "autocomplete": {
3
+ "no_suggestions": "No suggestions available"
4
+ },
5
+ "context_menu": {
6
+ "copy": "Copy",
7
+ "cut": "Cut",
8
+ "delete": "Delete",
9
+ "marker": {
10
+ "navigation": "Go to",
11
+ "next": "Next marker",
12
+ "previous": "Previous marker"
13
+ },
14
+ "paste": "Paste"
15
+ },
16
+ "diagram": {
17
+ "label": "Diagram"
9
18
  },
10
19
  "focus": {
11
20
  "focus_not_set": "Focus not set",
12
- "focus_on": "Currently focused: ",
13
21
  "focus_off": "Currently no element is focused.",
22
+ "focus_on": "Currently focused: ",
14
23
  "focus_within": "Within",
15
- "shortcut_focus_palette": "Focus on tool palette",
16
- "shortcut_focus_graph": "Focus on graph"
24
+ "shortcut_focus_graph": "Focus on graph",
25
+ "shortcut_focus_palette": "Focus on tool palette"
26
+ },
27
+ "grid": {
28
+ "shortcut_zoom_in": "Zoom in via grid",
29
+ "zoom_in_grid": "Select a digit from 1-9 to zoom in on the respective box."
30
+ },
31
+ "issue_marker": {
32
+ "severity_error": "ERROR",
33
+ "severity_info": "INFO",
34
+ "severity_warning": "WARNING"
35
+ },
36
+ "move": {
37
+ "shortcut_move": "Move element"
38
+ },
39
+ "navigation": {
40
+ "default_navigation_mode_activated": "Navigation On: Use arrow keys to select preceding (←) or succeding (→) elements. Use the up (↑) and down (↓) arrows to navigate paths. Press 'N' to exit.",
41
+ "default_navigation_mode_deactivated": "Navigation Off: Press 'N' for default navigation, 'ALT+N' for position based navigation.",
42
+ "local_navigation_mode_activated": "Position based Nav On: Navigate nearest elements using arrow keys: (↑) for above, (↓) for below, (←) for previous, (→) for next element. Press 'ALT+N' to exit.",
43
+ "local_navigation_mode_deactivated": "Position based Nav Off: Press 'N' for default navigation, 'ALT+N' for position based navigation.",
44
+ "shortcut_global_mode": "Activate global navigation mode",
45
+ "shortcut_local_mode": "Activate local navigation mode"
17
46
  },
18
47
  "resize": {
19
48
  "resize_mode_activated": "Resize On: Use plus(+) and minus(-) to resize, 'CTRL'+'0' for default size. Press 'ESC' to exit.",
20
49
  "resize_mode_deactivated": "Resize Off: Press 'ALT'+'A' for resize mode.",
21
50
  "shortcut_activate": "Activate resize mode for selected element",
22
51
  "shortcut_deactivate": "Deactivate resize handler",
23
- "shortcut_increase": "Increase size of element",
24
52
  "shortcut_decrease": "Decrease size of element",
53
+ "shortcut_increase": "Increase size of element",
25
54
  "shortcut_reset": "Set element size to default"
26
55
  },
27
- "move": {
28
- "shortcut_move": "Move element"
29
- },
30
- "grid": {
31
- "zoom_in_grid": "Select a digit from 1-9 to zoom in on the respective box.",
32
- "shortcut_zoom_in": "Zoom in via grid"
33
- },
34
56
  "search": {
35
- "shortcut_activate": "Activate search for elements",
57
+ "label": "Search Field",
36
58
  "placeholder": "Search for elements...",
37
- "label": "Search Field"
59
+ "shortcut_activate": "Activate search for elements"
60
+ },
61
+ "shortcut": {
62
+ "group_focus": "Focus",
63
+ "group_graph": "Graph",
64
+ "group_grid": "Grid",
65
+ "group_move": "Move",
66
+ "group_navigation": "Navigation",
67
+ "group_resize": "Resize",
68
+ "group_search": "Search",
69
+ "group_tool_palette": "Tool Palette",
70
+ "group_viewport": "Viewport",
71
+ "group_zoom": "Zoom",
72
+ "header_command": "Command",
73
+ "header_shortcut": "Keybinding",
74
+ "menu_title": "Shortcut Menu",
75
+ "title": "Keyboard Shortcuts"
38
76
  },
39
77
  "tool_palette": {
40
- "label": "Tool Palette",
78
+ "debug_mode_button": "Debug Mode",
41
79
  "delete_button": "Enable deletion tool",
80
+ "label": "Tool Palette",
42
81
  "marquee_button": "Enable marquee tool",
43
82
  "marquee_message": "Currently marquee tool is only usable with mouse.",
44
- "search_placeholder": "Search...",
83
+ "maximize": "Maximize palette",
84
+ "minimize": "Minimize palette",
85
+ "no_items": "No results found.",
86
+ "reset_viewport_button": "Reset Viewport",
45
87
  "search_button": "Filter palette entries",
88
+ "search_placeholder": "Search...",
46
89
  "selection_button": "Enable selection tool",
47
- "validate_button": "Validate model",
48
- "reset_viewport_button": "Reset Viewport",
49
90
  "toggle_grid_button": "Toggle Grid",
50
- "debug_mode_button": "Debug Mode",
51
- "minimize": "Minimize palette",
52
- "maximize": "Maximize palette",
53
- "no_items": "No results found."
91
+ "validate_button": "Validate model"
54
92
  },
55
93
  "viewport": {
56
94
  "shortcut_move_viewport": "Move viewport",
57
- "shortcut_zoom_viewport": "Zoom viewport",
58
- "shortcut_zoom_element": "Zoom element"
59
- },
60
- "shortcut": {
61
- "title": "Keyboard Shortcuts",
62
- "header_command": "Command",
63
- "header_shortcut": "Keybinding",
64
- "menu_title": "Shortcut Menu",
65
- "group_move": "Move",
66
- "group_graph": "Graph",
67
- "group_resize": "Resize",
68
- "group_focus": "Focus",
69
- "group_zoom": "Zoom",
70
- "group_navigation": "Navigation",
71
- "group_grid": "Grid",
72
- "group_search": "Search",
73
- "group_tool_palette": "Tool Palette",
74
- "group_viewport": "Viewport"
75
- },
76
- "diagram": {
77
- "label": "Diagram"
78
- },
79
- "autocomplete": {
80
- "no_suggestions": "No suggestions available"
81
- },
82
- "issue_marker": {
83
- "severity_error": "ERROR",
84
- "severity_warning": "WARNING",
85
- "severity_info": "INFO"
95
+ "shortcut_zoom_element": "Zoom element",
96
+ "shortcut_zoom_viewport": "Zoom viewport"
86
97
  }
87
98
  }
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2019-2024 EclipseSource and others.
2
+ * Copyright (c) 2019-2025 EclipseSource and others.
3
3
  *
4
4
  * This program and the accompanying materials are made available under the
5
5
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -133,8 +133,8 @@ export class ToolManager implements IToolManager, IDiagramStartup, IEditModeList
133
133
  this.actives.splice(0, this.actives.length);
134
134
  }
135
135
 
136
- enableDefaultTools(): void {
137
- if (this.defaultToolsEnabled) {
136
+ enableDefaultTools(force = false): void {
137
+ if (this.defaultToolsEnabled && !force) {
138
138
  return;
139
139
  }
140
140
  this.enable(pluck(this.defaultTools, 'id'));
@@ -171,7 +171,7 @@ export class ToolManager implements IToolManager, IDiagramStartup, IEditModeList
171
171
  if (newValue === EditMode.READONLY) {
172
172
  this.disableEditTools();
173
173
  } else if (newValue === EditMode.EDITABLE) {
174
- this.enableDefaultTools();
174
+ this.enableDefaultTools(true);
175
175
  }
176
176
  }
177
177
  }
@@ -47,6 +47,7 @@ import { labelEditModule } from './features/label-edit/label-edit-module';
47
47
  import { layoutModule } from './features/layout/layout-module';
48
48
  import { navigationModule } from './features/navigation/navigation-module';
49
49
  import { routingModule } from './features/routing/routing-module';
50
+ import { searchPaletteDefaultSuggestionsModule, searchPaletteModule } from './features/search-palette/search-palette-module';
50
51
  import { selectModule } from './features/select/select-module';
51
52
  import { sourceModelWatcherModule } from './features/source-model-watcher/source-model-watcher-module';
52
53
  import { statusModule } from './features/status/status-module';
@@ -101,7 +102,9 @@ export const DEFAULT_MODULES = [
101
102
  zorderModule,
102
103
  svgMetadataModule,
103
104
  statusModule,
104
- resizeModule
105
+ resizeModule,
106
+ searchPaletteModule,
107
+ searchPaletteDefaultSuggestionsModule
105
108
  ] as const;
106
109
 
107
110
  /**
@@ -17,9 +17,8 @@
17
17
  import { FeatureModule } from '@eclipse-glsp/sprotty';
18
18
  import { configureElementNavigationTool } from './element-navigation/element-navigation-module';
19
19
  import { configureFocusTrackerTool } from './focus-tracker/focus-tracker-module';
20
- import { configureKeyboardControlTools } from './keyboard-pointer/keyboard-pointer-module';
21
20
  import { configureKeyboardToolPaletteTool } from './keyboard-tool-palette/keyboard-tool-palette-module';
22
- import { configureSearchPaletteModule } from './search/search-palette-module';
21
+ import { configureKeyboardControlTools } from './keyboard/keyboard-module';
23
22
  import { configureToastTool } from './toast/toast-module';
24
23
  import { configureViewKeyTools } from './view-key-tools/view-key-tools-module';
25
24
 
@@ -30,7 +29,6 @@ export const accessibilityModule = new FeatureModule(
30
29
  (bind, unbind, isBound, rebind) => {
31
30
  const context = { bind, unbind, isBound, rebind };
32
31
  configureViewKeyTools(context);
33
- configureSearchPaletteModule(context);
34
32
  configureKeyboardToolPaletteTool(context);
35
33
  configureKeyboardControlTools(context);
36
34
  configureElementNavigationTool(context);
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2023-2024 Business Informatics Group (TU Wien) and others.
2
+ * Copyright (c) 2023-2025 Business Informatics Group (TU Wien) and others.
3
3
  *
4
4
  * This program and the accompanying materials are made available under the
5
5
  * terms of the Eclipse Public License v. 2.0 which is available at
@@ -29,76 +29,89 @@ import {
29
29
  } from '@eclipse-glsp/sprotty';
30
30
  import { injectable } from 'inversify';
31
31
  import { CloseReason, toActionArray } from '../../../base/auto-complete/auto-complete-widget';
32
- import { AutocompleteSuggestion, IAutocompleteSuggestionProvider } from '../../../base/auto-complete/autocomplete-suggestion-providers';
32
+ import { IAutocompleteSuggestionProvider, type AutocompleteSuggestion } from '../../../base/auto-complete/autocomplete-suggestion-provider';
33
33
  import { EnableDefaultToolsAction } from '../../../base/tool-manager/tool';
34
34
  import { GEdge } from '../../../model';
35
- import { SearchAutocompletePalette } from '../search/search-palette';
35
+ import { SearchAutocompletePalette, SearchAutocompleteSuggestion } from '../../search-palette/search-palette';
36
36
  import { SetEdgeTargetSelectionAction } from './action';
37
- import { EdgeAutocompleteContext } from './edge-autocomplete-context';
38
37
 
39
38
  export namespace EdgeAutocompletePaletteMetadata {
40
39
  export const ID = 'edge-autocomplete-palette';
41
40
  }
42
41
 
42
+ export interface EdgeAutocompleteContext {
43
+ role: 'source' | 'target';
44
+ triggerAction: TriggerEdgeCreationAction;
45
+ sourceId?: string;
46
+ targetId?: string;
47
+ }
48
+
49
+ export type EdgeAutocompletePaletteStages = 'initial' | 'source' | 'target' | 'reloading';
50
+
43
51
  @injectable()
44
52
  export class EdgeAutocompletePalette extends SearchAutocompletePalette implements IActionHandler {
45
- protected context?: EdgeAutocompleteContext;
46
-
47
- protected readonly targetSuggestionProvider = new PossibleEdgeTargetAutocompleteSuggestionProvider();
53
+ protected edgeAutocompleteContext?: EdgeAutocompleteContext;
54
+ protected stage: EdgeAutocompletePaletteStages = 'initial';
48
55
 
49
56
  override id(): string {
50
57
  return EdgeAutocompletePaletteMetadata.ID;
51
58
  }
52
59
 
60
+ override get searchContext(): string[] {
61
+ return [EdgeAutocompletePaletteMetadata.ID];
62
+ }
63
+
53
64
  handle(action: Action): Action | void {
54
65
  if (TriggerEdgeCreationAction.is(action)) {
55
- this.context = {
56
- trigger: action,
66
+ this.stage = 'source';
67
+ this.edgeAutocompleteContext = {
68
+ triggerAction: action,
57
69
  role: 'source'
58
70
  };
59
- this.targetSuggestionProvider.setContext(action, this.context);
60
71
  }
61
72
  }
62
73
 
63
74
  protected override onBeforeShow(containerElement: HTMLElement, root: Readonly<GModelRoot>, ...contextElementIds: string[]): void {
64
75
  super.onBeforeShow(containerElement, root, ...contextElementIds);
65
76
 
66
- this.autocompleteWidget.inputField.placeholder = `Search for ${this.context?.role} elements`;
77
+ this.autocompleteWidget.inputField.placeholder = `Search for ${this.edgeAutocompleteContext?.role} elements`;
67
78
  }
68
79
 
69
- protected override getSuggestionProviders(root: Readonly<GModelRoot>, input: string): IAutocompleteSuggestionProvider[] {
70
- return [this.targetSuggestionProvider];
80
+ protected async reload(): Promise<void> {
81
+ this.stage = 'reloading';
82
+ this.hide();
71
83
  }
72
84
 
73
- protected reload(): void {
74
- const context = this.context;
75
- this.hide();
76
- this.context = context;
77
- this.actionDispatcher.dispatch(
78
- SetUIExtensionVisibilityAction.create({
79
- extensionId: EdgeAutocompletePaletteMetadata.ID,
80
- visible: true
81
- })
82
- );
85
+ protected override async provideSearchSuggestions(root: Readonly<GModelRoot>, input: string): Promise<SearchAutocompleteSuggestion[]> {
86
+ return (
87
+ await Promise.all(
88
+ this.suggestionRegistry
89
+ .providersForContext(this.searchContext)
90
+ .flatMap(provider => provider.getSuggestions(root, input, this.edgeAutocompleteContext))
91
+ )
92
+ )
93
+ .flat(1)
94
+ .filter(SearchAutocompleteSuggestion.is);
83
95
  }
84
96
 
85
- protected override executeSuggestion(input: LabeledAction | Action[] | Action): void {
97
+ protected override async executeSuggestion(input: LabeledAction | Action[] | Action): Promise<void> {
86
98
  const action = toActionArray(input)[0] as SetEdgeTargetSelectionAction;
87
99
 
88
- if (this.context?.role === 'source') {
89
- this.context.sourceId = action.elementId;
90
- this.context.role = 'target';
100
+ if (this.edgeAutocompleteContext?.role === 'source') {
101
+ this.edgeAutocompleteContext.sourceId = action.elementId;
102
+ this.edgeAutocompleteContext.role = 'target';
91
103
  this.reload();
92
- } else if (this.context?.role === 'target') {
93
- this.context.targetId = action.elementId;
104
+ } else if (this.edgeAutocompleteContext?.role === 'target') {
105
+ this.edgeAutocompleteContext.targetId = action.elementId;
94
106
  }
95
- if (this.context?.sourceId !== undefined && this.context?.targetId !== undefined) {
96
- this.actionDispatcher.dispatchAll([
107
+
108
+ if (this.edgeAutocompleteContext?.sourceId !== undefined && this.edgeAutocompleteContext?.targetId !== undefined) {
109
+ await this.actionDispatcher.dispatchAll([
97
110
  CreateEdgeOperation.create({
98
- elementTypeId: this.context.trigger.elementTypeId,
99
- sourceElementId: this.context.sourceId,
100
- targetElementId: this.context.targetId,
101
- args: this.context.trigger.args
111
+ elementTypeId: this.edgeAutocompleteContext.triggerAction.elementTypeId,
112
+ sourceElementId: this.edgeAutocompleteContext.sourceId,
113
+ targetElementId: this.edgeAutocompleteContext.targetId,
114
+ args: this.edgeAutocompleteContext.triggerAction.args
102
115
  }),
103
116
  EnableDefaultToolsAction.create()
104
117
  ]);
@@ -107,41 +120,51 @@ export class EdgeAutocompletePalette extends SearchAutocompletePalette implement
107
120
  }
108
121
 
109
122
  protected override autocompleteHide(reason: CloseReason): void {
110
- if (reason !== 'submission') {
123
+ if (this.stage === 'reloading') {
124
+ // Wait until the auto complete is closed before reloading
125
+ if (reason === 'blur') {
126
+ this.actionDispatcher.dispatch(
127
+ SetUIExtensionVisibilityAction.create({
128
+ extensionId: EdgeAutocompletePaletteMetadata.ID,
129
+ visible: true
130
+ })
131
+ );
132
+ this.stage = 'target';
133
+ }
134
+ } else if (reason !== 'submission') {
111
135
  this.hide();
112
136
  }
113
137
  }
114
138
  }
115
139
 
116
140
  @injectable()
117
- export class PossibleEdgeTargetAutocompleteSuggestionProvider implements IAutocompleteSuggestionProvider {
118
- protected proxyEdge?: GEdge;
119
- protected context?: EdgeAutocompleteContext;
120
-
121
- setContext(triggerAction: TriggerEdgeCreationAction, edgeAutocompleteContext: EdgeAutocompleteContext): void {
122
- this.proxyEdge = new GEdge();
123
- this.proxyEdge.type = triggerAction.elementTypeId;
124
- this.context = edgeAutocompleteContext;
125
- }
141
+ export class SetEdgeTargetGridSuggestionProvider implements IAutocompleteSuggestionProvider {
142
+ id = 'glsp.set-edge-target-autocomplete-suggestions';
126
143
 
127
- isAllowedSource(element: GModelElement | undefined, role: 'source' | 'target'): boolean {
128
- return element !== undefined && this.proxyEdge !== undefined && isConnectable(element) && element.canConnect(this.proxyEdge, role);
144
+ canHandle(searchContext: string): boolean {
145
+ return searchContext === EdgeAutocompletePaletteMetadata.ID;
129
146
  }
130
147
 
131
- async retrieveSuggestions(root: Readonly<GModelRoot>, text: string): Promise<AutocompleteSuggestion[]> {
132
- const context = this.context;
133
- if (this.context === undefined) {
148
+ async getSuggestions(root: Readonly<GModelRoot>, text: string, context: EdgeAutocompleteContext): Promise<AutocompleteSuggestion[]> {
149
+ if (context === undefined) {
134
150
  return [];
135
151
  }
136
152
 
137
- const nodes = toArray(root.index.all().filter(element => this.isAllowedSource(element, context!.role))) as GEdge[];
153
+ const proxyEdge = new GEdge();
154
+ proxyEdge.type = context.triggerAction.elementTypeId;
155
+
156
+ const nodes = toArray(root.index.all().filter(element => this.isAllowedSource(proxyEdge, element, context.role))) as GEdge[];
138
157
  return nodes.map(node => ({
139
158
  element: node,
140
159
  action: {
141
160
  label: `[${node.type}] ${name(node) ?? '<no-name>'}`,
142
- actions: [SetEdgeTargetSelectionAction.create(node.id, context!.role)],
161
+ actions: [SetEdgeTargetSelectionAction.create(node.id, context.role)],
143
162
  icon: codiconCSSString('arrow-both')
144
163
  }
145
164
  }));
146
165
  }
166
+
167
+ protected isAllowedSource(proxyEdge: GEdge, element: GModelElement | undefined, role: 'source' | 'target'): boolean {
168
+ return element !== undefined && proxyEdge !== undefined && isConnectable(element) && element.canConnect(proxyEdge, role);
169
+ }
147
170
  }
@@ -38,7 +38,6 @@ import { GEdge } from '../../../model';
38
38
  import { SelectableBoundsAware } from '../../../utils/gmodel-util';
39
39
  import { BaseTool } from '../../tools/base-tools';
40
40
  import { RepositionAction } from '../../viewport/reposition';
41
- import { SearchAutocompletePaletteTool } from '../search/search-tool';
42
41
  import { ShowToastMessageAction } from '../toast/toast-handler';
43
42
  import { ElementNavigator } from './element-navigator';
44
43
 
@@ -144,7 +143,7 @@ export class ElementNavigatorKeyListener extends KeyListener {
144
143
  if (this.mode !== NavigationMode.POSITION) {
145
144
  this.clean();
146
145
  this.tool.dispatchActions([
147
- EnableToolsAction.create([ElementNavigatorTool.ID, SearchAutocompletePaletteTool.ID, AvailableShortcutsTool.ID]),
146
+ EnableToolsAction.create([ElementNavigatorTool.ID, AvailableShortcutsTool.ID]),
148
147
  ShowToastMessageAction.create({
149
148
  id: Symbol.for(ElementNavigatorKeyListener.name),
150
149
  message: messages.navigation.local_navigation_mode_activated
@@ -180,9 +179,8 @@ export class ElementNavigatorKeyListener extends KeyListener {
180
179
  if (this.matchesActivateDefaultNavigation(event)) {
181
180
  if (this.mode !== NavigationMode.DEFAULT) {
182
181
  this.clean();
183
-
184
182
  this.tool.dispatchActions([
185
- EnableToolsAction.create([ElementNavigatorTool.ID, SearchAutocompletePaletteTool.ID, AvailableShortcutsTool.ID]),
183
+ EnableToolsAction.create([ElementNavigatorTool.ID, AvailableShortcutsTool.ID]),
186
184
  ShowToastMessageAction.create({
187
185
  id: Symbol.for(ElementNavigatorKeyListener.name),
188
186
  message: messages.navigation.default_navigation_mode_activated