@adecore/editor-react 0.25.9 → 0.26.1
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.
- package/dist/EditorContextMenu.js +36 -13
- package/dist/context-menu-rows.d.ts +14 -0
- package/dist/context-menu-rows.js +20 -0
- package/dist/language-ids.js +4 -2
- package/dist/locales/en.json +9 -1
- package/dist/locales/nl.json +9 -1
- package/package.json +6 -6
- package/src/EditorContextMenu.tsx +52 -19
- package/src/EditorView.tsx +1 -1
- package/src/LanguagePopups.tsx +1 -1
- package/src/context-menu-rows.ts +40 -0
- package/src/language-ids.ts +4 -2
- package/src/locales/en.json +9 -1
- package/src/locales/nl.json +9 -1
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment, useEffect, useRef } from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { ContextMenu, Kbd } from '@adecore/ui';
|
|
4
|
+
import { ContextMenu, EDIT_SHORTCUTS, Kbd } from '@adecore/ui';
|
|
5
|
+
import { menuGroupsOf } from './context-menu-rows.js';
|
|
6
|
+
/*
|
|
7
|
+
* The menu in groups: where to go, what refers to a symbol, what changes it, the app's own rows, the
|
|
8
|
+
* clipboard and formatting. A group left empty draws no line, since the theme hides a separator that
|
|
9
|
+
* comes first, last or twice.
|
|
10
|
+
*/
|
|
5
11
|
export function EditorContextMenu({ language, view, children }) {
|
|
6
12
|
const { t } = useTranslation('editor');
|
|
7
13
|
const trigger = useRef(null);
|
|
@@ -9,16 +15,33 @@ export function EditorContextMenu({ language, view, children }) {
|
|
|
9
15
|
trigger.current?.dispatchEvent(new MouseEvent('contextmenu', { bubbles: true, clientX: view.x, clientY: view.y }));
|
|
10
16
|
}, [view.x, view.y]);
|
|
11
17
|
const { service } = language.project;
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
const groups = menuGroupsOf((method) => service.supports(method, language.uri));
|
|
19
|
+
const run = {
|
|
20
|
+
definition: () => void language.navigation.go('definition'),
|
|
21
|
+
declaration: () => void language.navigation.go('declaration'),
|
|
22
|
+
typeDefinition: () => void language.navigation.go('typeDefinition'),
|
|
23
|
+
implementation: () => void language.navigation.go('implementation'),
|
|
24
|
+
peekReferences: () => void language.peek.open(),
|
|
25
|
+
callHierarchy: () => void language.callHierarchy.open(),
|
|
26
|
+
renameSymbol: () => void language.rename.start(),
|
|
27
|
+
codeActions: () => void language.codeActions.open()
|
|
28
|
+
};
|
|
29
|
+
const label = (id) => {
|
|
30
|
+
switch (id) {
|
|
31
|
+
case 'definition':
|
|
32
|
+
case 'declaration':
|
|
33
|
+
case 'typeDefinition':
|
|
34
|
+
case 'implementation':
|
|
35
|
+
return t(`language.context.goTo.${id}`);
|
|
36
|
+
case 'renameSymbol':
|
|
37
|
+
return t('language.context.renameSymbol');
|
|
38
|
+
default:
|
|
39
|
+
return t(`commands.${id}`);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const item = (row) => {
|
|
43
|
+
const shortcut = row.shortcut === null ? null : language.shortcuts[row.shortcut];
|
|
44
|
+
return (_jsxs(ContextMenu.Item, { onClick: run[row.id], children: [label(row.id), shortcut !== null && _jsx(Kbd, { shortcut: shortcut })] }, row.id));
|
|
45
|
+
};
|
|
46
|
+
return (_jsxs(ContextMenu.Root, { onOpenChange: (open) => !open && language.contextMenu.close(), children: [_jsx(ContextMenu.Trigger, { ref: trigger, className: "fixed top-0 left-0 h-0 w-0", "aria-hidden": true }), _jsxs(ContextMenu.Popup, { children: [groups.goTo.length > 0 && (_jsxs(ContextMenu.SubmenuRoot, { children: [_jsx(ContextMenu.SubmenuTrigger, { children: t('language.context.goTo.menu') }), _jsx(ContextMenu.Popup, { children: groups.goTo.map(item) })] })), _jsx(ContextMenu.Separator, {}), groups.references.map(item), _jsx(ContextMenu.Separator, {}), groups.changes.map(item), view.refactors.length > 0 && (_jsxs(ContextMenu.SubmenuRoot, { children: [_jsx(ContextMenu.SubmenuTrigger, { children: t('language.context.refactor') }), _jsx(ContextMenu.Popup, { children: view.refactors.map((entry, index) => (_jsxs(Fragment, { children: [index > 0 && view.refactors[index - 1].group !== entry.group && _jsx(ContextMenu.Separator, {}), _jsx(ContextMenu.Item, { onClick: () => void language.codeActions.apply(entry), children: entry.action.title })] }, entry.id))) })] })), _jsx(ContextMenu.Separator, {}), children, _jsx(ContextMenu.Separator, {}), ['cut', 'copy', 'paste'].map((action) => (_jsxs(ContextMenu.Item, { onClick: () => language.contextMenu.clipboard(action), children: [t(`language.context.${action}`), _jsx(Kbd, { shortcut: EDIT_SHORTCUTS[action] })] }, action))), service.supports('textDocument/formatting', language.uri) && (_jsxs(_Fragment, { children: [_jsx(ContextMenu.Separator, {}), _jsxs(ContextMenu.Item, { onClick: () => void language.codeActions.formatDocument(), children: [t('commands.formatDocument'), language.shortcuts.formatDocument !== null && _jsx(Kbd, { shortcut: language.shortcuts.formatDocument })] })] }))] })] }));
|
|
24
47
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { KeymapId } from '@adecore/editor/keymap';
|
|
2
|
+
import type { NavigationKind } from './navigation.ts';
|
|
3
|
+
export type MenuRowId = NavigationKind | 'peekReferences' | 'callHierarchy' | 'renameSymbol' | 'codeActions';
|
|
4
|
+
export interface MenuRowSpec {
|
|
5
|
+
readonly id: MenuRowId;
|
|
6
|
+
readonly method: string;
|
|
7
|
+
readonly shortcut: KeymapId | null;
|
|
8
|
+
}
|
|
9
|
+
export interface MenuGroups {
|
|
10
|
+
readonly goTo: readonly MenuRowSpec[];
|
|
11
|
+
readonly references: readonly MenuRowSpec[];
|
|
12
|
+
readonly changes: readonly MenuRowSpec[];
|
|
13
|
+
}
|
|
14
|
+
export declare function menuGroupsOf(supports: (method: string) => boolean): MenuGroups;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* The rows of the Go to submenu. Declaration has no key of its own in the table. */
|
|
2
|
+
const GO_TO = [
|
|
3
|
+
{ id: 'definition', method: 'textDocument/definition', shortcut: 'goToDefinition' },
|
|
4
|
+
{ id: 'declaration', method: 'textDocument/declaration', shortcut: null },
|
|
5
|
+
{ id: 'typeDefinition', method: 'textDocument/typeDefinition', shortcut: 'goToTypeDefinition' },
|
|
6
|
+
{ id: 'implementation', method: 'textDocument/implementation', shortcut: 'goToImplementation' }
|
|
7
|
+
];
|
|
8
|
+
const REFERENCES = [
|
|
9
|
+
{ id: 'peekReferences', method: 'textDocument/references', shortcut: 'peekReferences' },
|
|
10
|
+
{ id: 'callHierarchy', method: 'textDocument/prepareCallHierarchy', shortcut: 'callHierarchy' }
|
|
11
|
+
];
|
|
12
|
+
const CHANGES = [
|
|
13
|
+
{ id: 'renameSymbol', method: 'textDocument/rename', shortcut: 'renameSymbol' },
|
|
14
|
+
{ id: 'codeActions', method: 'textDocument/codeAction', shortcut: 'codeActions' }
|
|
15
|
+
];
|
|
16
|
+
/* The language rows of the context menu in their groups, each holding only the rows a server answers. */
|
|
17
|
+
export function menuGroupsOf(supports) {
|
|
18
|
+
const supported = (rows) => rows.filter((row) => supports(row.method));
|
|
19
|
+
return { goTo: supported(GO_TO), references: supported(REFERENCES), changes: supported(CHANGES) };
|
|
20
|
+
}
|
package/dist/language-ids.js
CHANGED
|
@@ -17,7 +17,8 @@ const LSP_IDS = {
|
|
|
17
17
|
shellscript: 'shellscript',
|
|
18
18
|
docker: 'dockerfile',
|
|
19
19
|
twig: 'twig',
|
|
20
|
-
sql: 'sql'
|
|
20
|
+
sql: 'sql',
|
|
21
|
+
rust: 'rust'
|
|
21
22
|
};
|
|
22
23
|
/* The LSP language id of a file, or null when no language server here knows its language. */
|
|
23
24
|
export function lspLanguageIdOf(language) {
|
|
@@ -45,7 +46,8 @@ const PATH_IDS = {
|
|
|
45
46
|
html: 'html',
|
|
46
47
|
md: 'markdown',
|
|
47
48
|
twig: 'twig',
|
|
48
|
-
sql: 'sql'
|
|
49
|
+
sql: 'sql',
|
|
50
|
+
rs: 'rust'
|
|
49
51
|
};
|
|
50
52
|
/* The highlighter id for the code of a file we only know by its path, such as a place another file refers to. */
|
|
51
53
|
export function shikiLanguageOfPath(path) {
|
package/dist/locales/en.json
CHANGED
|
@@ -166,7 +166,15 @@
|
|
|
166
166
|
"refactor": "Refactor",
|
|
167
167
|
"cut": "Cut",
|
|
168
168
|
"copy": "Copy",
|
|
169
|
-
"paste": "Paste"
|
|
169
|
+
"paste": "Paste",
|
|
170
|
+
"renameSymbol": "Rename symbol…",
|
|
171
|
+
"goTo": {
|
|
172
|
+
"menu": "Go to",
|
|
173
|
+
"definition": "Definition",
|
|
174
|
+
"declaration": "Declaration",
|
|
175
|
+
"typeDefinition": "Type definition",
|
|
176
|
+
"implementation": "Implementation"
|
|
177
|
+
}
|
|
170
178
|
},
|
|
171
179
|
"snippet": {
|
|
172
180
|
"choices": "Snippet choice"
|
package/dist/locales/nl.json
CHANGED
|
@@ -166,7 +166,15 @@
|
|
|
166
166
|
"refactor": "Refactor",
|
|
167
167
|
"cut": "Knip",
|
|
168
168
|
"copy": "Kopieer",
|
|
169
|
-
"paste": "Plak"
|
|
169
|
+
"paste": "Plak",
|
|
170
|
+
"renameSymbol": "Symbool hernoemen…",
|
|
171
|
+
"goTo": {
|
|
172
|
+
"menu": "Ga naar",
|
|
173
|
+
"definition": "Definitie",
|
|
174
|
+
"declaration": "Declaratie",
|
|
175
|
+
"typeDefinition": "Typedefinitie",
|
|
176
|
+
"implementation": "Implementatie"
|
|
177
|
+
}
|
|
170
178
|
},
|
|
171
179
|
"snippet": {
|
|
172
180
|
"choices": "Snippetkeuze"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adecore/editor-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Language-enabled editors, feature coordination and React popups over injected language services.",
|
|
6
6
|
"license": "FSL-1.1-MIT",
|
|
@@ -62,9 +62,9 @@
|
|
|
62
62
|
"test": "bun test --conditions=source"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@adecore/editor": "0.
|
|
66
|
-
"@adecore/lsp": "0.
|
|
67
|
-
"@adecore/merge": "0.
|
|
65
|
+
"@adecore/editor": "0.26.1",
|
|
66
|
+
"@adecore/lsp": "0.26.1",
|
|
67
|
+
"@adecore/merge": "0.26.1",
|
|
68
68
|
"lucide-react": "^1.47.0",
|
|
69
69
|
"react-markdown": "^10.1.0",
|
|
70
70
|
"remark-breaks": "^4.0.0",
|
|
@@ -72,14 +72,14 @@
|
|
|
72
72
|
"zustand": "^5.0.15"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"@adecore/ui": "^0.
|
|
75
|
+
"@adecore/ui": "^0.26.1",
|
|
76
76
|
"i18next": "^26.4.2",
|
|
77
77
|
"react": "^19.3.0",
|
|
78
78
|
"react-dom": "^19.3.0",
|
|
79
79
|
"react-i18next": "^17.0.15"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@adecore/ui": "0.
|
|
82
|
+
"@adecore/ui": "0.26.1",
|
|
83
83
|
"@types/bun": "^1.4.2",
|
|
84
84
|
"@types/react": "^19.3.0",
|
|
85
85
|
"@types/react-dom": "^19.3.0",
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { Fragment, useEffect, useRef, type ReactNode } from 'react';
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import { ContextMenu, Kbd } from '@adecore/ui';
|
|
4
|
-
import type { KeymapId } from '@adecore/editor/keymap';
|
|
3
|
+
import { ContextMenu, EDIT_SHORTCUTS, Kbd } from '@adecore/ui';
|
|
5
4
|
import type { EditorLanguage } from './editor-language.ts';
|
|
5
|
+
import { menuGroupsOf, type MenuRowId, type MenuRowSpec } from './context-menu-rows.ts';
|
|
6
6
|
import type { MenuView } from './popups.ts';
|
|
7
7
|
|
|
8
|
+
/*
|
|
9
|
+
* The menu in groups: where to go, what refers to a symbol, what changes it, the app's own rows, the
|
|
10
|
+
* clipboard and formatting. A group left empty draws no line, since the theme hides a separator that
|
|
11
|
+
* comes first, last or twice.
|
|
12
|
+
*/
|
|
8
13
|
export function EditorContextMenu({ language, view, children }: { language: EditorLanguage; view: MenuView; children?: ReactNode }) {
|
|
9
14
|
const { t } = useTranslation('editor');
|
|
10
15
|
const trigger = useRef<HTMLDivElement>(null);
|
|
@@ -12,27 +17,53 @@ export function EditorContextMenu({ language, view, children }: { language: Edit
|
|
|
12
17
|
trigger.current?.dispatchEvent(new MouseEvent('contextmenu', { bubbles: true, clientX: view.x, clientY: view.y }));
|
|
13
18
|
}, [view.x, view.y]);
|
|
14
19
|
const { service } = language.project;
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const groups = menuGroupsOf((method) => service.supports(method, language.uri));
|
|
21
|
+
const run: Record<MenuRowId, () => void> = {
|
|
22
|
+
definition: () => void language.navigation.go('definition'),
|
|
23
|
+
declaration: () => void language.navigation.go('declaration'),
|
|
24
|
+
typeDefinition: () => void language.navigation.go('typeDefinition'),
|
|
25
|
+
implementation: () => void language.navigation.go('implementation'),
|
|
26
|
+
peekReferences: () => void language.peek.open(),
|
|
27
|
+
callHierarchy: () => void language.callHierarchy.open(),
|
|
28
|
+
renameSymbol: () => void language.rename.start(),
|
|
29
|
+
codeActions: () => void language.codeActions.open()
|
|
30
|
+
};
|
|
31
|
+
const label = (id: MenuRowId): string => {
|
|
32
|
+
switch (id) {
|
|
33
|
+
case 'definition':
|
|
34
|
+
case 'declaration':
|
|
35
|
+
case 'typeDefinition':
|
|
36
|
+
case 'implementation':
|
|
37
|
+
return t(`language.context.goTo.${id}`);
|
|
38
|
+
case 'renameSymbol':
|
|
39
|
+
return t('language.context.renameSymbol');
|
|
40
|
+
default:
|
|
41
|
+
return t(`commands.${id}`);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const item = (row: MenuRowSpec): ReactNode => {
|
|
45
|
+
const shortcut = row.shortcut === null ? null : language.shortcuts[row.shortcut];
|
|
46
|
+
return (
|
|
47
|
+
<ContextMenu.Item key={row.id} onClick={run[row.id]}>
|
|
48
|
+
{label(row.id)}
|
|
49
|
+
{shortcut !== null && <Kbd shortcut={shortcut} />}
|
|
50
|
+
</ContextMenu.Item>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
24
53
|
return (
|
|
25
54
|
<ContextMenu.Root onOpenChange={(open) => !open && language.contextMenu.close()}>
|
|
26
55
|
<ContextMenu.Trigger ref={trigger} className="fixed top-0 left-0 h-0 w-0" aria-hidden />
|
|
27
56
|
<ContextMenu.Popup>
|
|
28
|
-
{
|
|
29
|
-
.
|
|
30
|
-
|
|
31
|
-
<ContextMenu.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
57
|
+
{groups.goTo.length > 0 && (
|
|
58
|
+
<ContextMenu.SubmenuRoot>
|
|
59
|
+
<ContextMenu.SubmenuTrigger>{t('language.context.goTo.menu')}</ContextMenu.SubmenuTrigger>
|
|
60
|
+
<ContextMenu.Popup>{groups.goTo.map(item)}</ContextMenu.Popup>
|
|
61
|
+
</ContextMenu.SubmenuRoot>
|
|
62
|
+
)}
|
|
63
|
+
<ContextMenu.Separator />
|
|
64
|
+
{groups.references.map(item)}
|
|
65
|
+
<ContextMenu.Separator />
|
|
66
|
+
{groups.changes.map(item)}
|
|
36
67
|
{view.refactors.length > 0 && (
|
|
37
68
|
<ContextMenu.SubmenuRoot>
|
|
38
69
|
<ContextMenu.SubmenuTrigger>{t('language.context.refactor')}</ContextMenu.SubmenuTrigger>
|
|
@@ -46,11 +77,13 @@ export function EditorContextMenu({ language, view, children }: { language: Edit
|
|
|
46
77
|
</ContextMenu.Popup>
|
|
47
78
|
</ContextMenu.SubmenuRoot>
|
|
48
79
|
)}
|
|
80
|
+
<ContextMenu.Separator />
|
|
49
81
|
{children}
|
|
50
82
|
<ContextMenu.Separator />
|
|
51
83
|
{(['cut', 'copy', 'paste'] as const).map((action) => (
|
|
52
84
|
<ContextMenu.Item key={action} onClick={() => language.contextMenu.clipboard(action)}>
|
|
53
85
|
{t(`language.context.${action}`)}
|
|
86
|
+
<Kbd shortcut={EDIT_SHORTCUTS[action]} />
|
|
54
87
|
</ContextMenu.Item>
|
|
55
88
|
))}
|
|
56
89
|
{service.supports('textDocument/formatting', language.uri) && (
|
package/src/EditorView.tsx
CHANGED
|
@@ -32,7 +32,7 @@ export interface EditorViewProps {
|
|
|
32
32
|
ref?: Ref<HTMLDivElement>;
|
|
33
33
|
/* Read when the editor mounts, so an inline function does not mount it again. */
|
|
34
34
|
onMount?(editor: Editor, language: EditorLanguage | null): void | (() => void);
|
|
35
|
-
/*
|
|
35
|
+
/* A group of the app's own rows in the context menu, set apart between the refactorings and the clipboard rows. */
|
|
36
36
|
contextMenuItems?(language: EditorLanguage): ReactNode;
|
|
37
37
|
/* Sections of the app at the foot of the hover card, such as actions on its problems. */
|
|
38
38
|
hoverFooter?(view: HoverView, language: EditorLanguage): ReactNode;
|
package/src/LanguagePopups.tsx
CHANGED
|
@@ -17,7 +17,7 @@ import type { HoverView } from './popups.ts';
|
|
|
17
17
|
|
|
18
18
|
export interface LanguagePopupsProps<Language extends EditorLanguage = EditorLanguage> {
|
|
19
19
|
language: Language;
|
|
20
|
-
/*
|
|
20
|
+
/* A group of the app's own rows in the context menu, set apart between the refactorings and the clipboard rows. */
|
|
21
21
|
contextMenuItems?(language: Language): ReactNode;
|
|
22
22
|
/* Sections of the app at the foot of the hover card, such as actions on its problems; each element gets a divider above it. */
|
|
23
23
|
hoverFooter?(view: HoverView, language: Language): ReactNode;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { KeymapId } from '@adecore/editor/keymap';
|
|
2
|
+
import type { NavigationKind } from './navigation.ts';
|
|
3
|
+
|
|
4
|
+
export type MenuRowId = NavigationKind | 'peekReferences' | 'callHierarchy' | 'renameSymbol' | 'codeActions';
|
|
5
|
+
|
|
6
|
+
export interface MenuRowSpec {
|
|
7
|
+
readonly id: MenuRowId;
|
|
8
|
+
readonly method: string;
|
|
9
|
+
readonly shortcut: KeymapId | null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/* The rows of the Go to submenu. Declaration has no key of its own in the table. */
|
|
13
|
+
const GO_TO: readonly MenuRowSpec[] = [
|
|
14
|
+
{ id: 'definition', method: 'textDocument/definition', shortcut: 'goToDefinition' },
|
|
15
|
+
{ id: 'declaration', method: 'textDocument/declaration', shortcut: null },
|
|
16
|
+
{ id: 'typeDefinition', method: 'textDocument/typeDefinition', shortcut: 'goToTypeDefinition' },
|
|
17
|
+
{ id: 'implementation', method: 'textDocument/implementation', shortcut: 'goToImplementation' }
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
const REFERENCES: readonly MenuRowSpec[] = [
|
|
21
|
+
{ id: 'peekReferences', method: 'textDocument/references', shortcut: 'peekReferences' },
|
|
22
|
+
{ id: 'callHierarchy', method: 'textDocument/prepareCallHierarchy', shortcut: 'callHierarchy' }
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
const CHANGES: readonly MenuRowSpec[] = [
|
|
26
|
+
{ id: 'renameSymbol', method: 'textDocument/rename', shortcut: 'renameSymbol' },
|
|
27
|
+
{ id: 'codeActions', method: 'textDocument/codeAction', shortcut: 'codeActions' }
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
export interface MenuGroups {
|
|
31
|
+
readonly goTo: readonly MenuRowSpec[];
|
|
32
|
+
readonly references: readonly MenuRowSpec[];
|
|
33
|
+
readonly changes: readonly MenuRowSpec[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* The language rows of the context menu in their groups, each holding only the rows a server answers. */
|
|
37
|
+
export function menuGroupsOf(supports: (method: string) => boolean): MenuGroups {
|
|
38
|
+
const supported = (rows: readonly MenuRowSpec[]): MenuRowSpec[] => rows.filter((row) => supports(row.method));
|
|
39
|
+
return { goTo: supported(GO_TO), references: supported(REFERENCES), changes: supported(CHANGES) };
|
|
40
|
+
}
|
package/src/language-ids.ts
CHANGED
|
@@ -17,7 +17,8 @@ const LSP_IDS: Record<string, string> = {
|
|
|
17
17
|
shellscript: 'shellscript',
|
|
18
18
|
docker: 'dockerfile',
|
|
19
19
|
twig: 'twig',
|
|
20
|
-
sql: 'sql'
|
|
20
|
+
sql: 'sql',
|
|
21
|
+
rust: 'rust'
|
|
21
22
|
};
|
|
22
23
|
|
|
23
24
|
/* The LSP language id of a file, or null when no language server here knows its language. */
|
|
@@ -49,7 +50,8 @@ const PATH_IDS: Record<string, string> = {
|
|
|
49
50
|
html: 'html',
|
|
50
51
|
md: 'markdown',
|
|
51
52
|
twig: 'twig',
|
|
52
|
-
sql: 'sql'
|
|
53
|
+
sql: 'sql',
|
|
54
|
+
rs: 'rust'
|
|
53
55
|
};
|
|
54
56
|
|
|
55
57
|
/* The highlighter id for the code of a file we only know by its path, such as a place another file refers to. */
|
package/src/locales/en.json
CHANGED
|
@@ -166,7 +166,15 @@
|
|
|
166
166
|
"refactor": "Refactor",
|
|
167
167
|
"cut": "Cut",
|
|
168
168
|
"copy": "Copy",
|
|
169
|
-
"paste": "Paste"
|
|
169
|
+
"paste": "Paste",
|
|
170
|
+
"renameSymbol": "Rename symbol…",
|
|
171
|
+
"goTo": {
|
|
172
|
+
"menu": "Go to",
|
|
173
|
+
"definition": "Definition",
|
|
174
|
+
"declaration": "Declaration",
|
|
175
|
+
"typeDefinition": "Type definition",
|
|
176
|
+
"implementation": "Implementation"
|
|
177
|
+
}
|
|
170
178
|
},
|
|
171
179
|
"snippet": {
|
|
172
180
|
"choices": "Snippet choice"
|
package/src/locales/nl.json
CHANGED
|
@@ -166,7 +166,15 @@
|
|
|
166
166
|
"refactor": "Refactor",
|
|
167
167
|
"cut": "Knip",
|
|
168
168
|
"copy": "Kopieer",
|
|
169
|
-
"paste": "Plak"
|
|
169
|
+
"paste": "Plak",
|
|
170
|
+
"renameSymbol": "Symbool hernoemen…",
|
|
171
|
+
"goTo": {
|
|
172
|
+
"menu": "Ga naar",
|
|
173
|
+
"definition": "Definitie",
|
|
174
|
+
"declaration": "Declaratie",
|
|
175
|
+
"typeDefinition": "Typedefinitie",
|
|
176
|
+
"implementation": "Implementatie"
|
|
177
|
+
}
|
|
170
178
|
},
|
|
171
179
|
"snippet": {
|
|
172
180
|
"choices": "Snippetkeuze"
|