@nocturnium/svelte-ide 1.0.0 → 1.0.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/README.md +43 -47
- package/dist/components/agents/AgentActivityPanel.svelte +3 -1
- package/dist/components/agents/AgentAvatar.svelte +127 -35
- package/dist/components/agents/AgentCursor.svelte +15 -5
- package/dist/components/agents/AgentPresenceBar.svelte +7 -2
- package/dist/components/ai/AIConversationList.svelte +39 -34
- package/dist/components/ai/AIInlineEdit.svelte +1 -3
- package/dist/components/ai/AIMessage.svelte +5 -5
- package/dist/components/ai/AIMessageActions.svelte +18 -3
- package/dist/components/ai/AIMessageContent.svelte +22 -20
- package/dist/components/ai/AIPanel.svelte +17 -9
- package/dist/components/ai/AISuggestionWidget.svelte +1 -3
- package/dist/components/ai/AIToolCallDisplay.svelte +10 -14
- package/dist/components/core/Badge.svelte +9 -1
- package/dist/components/core/ConnectionStatus.svelte +73 -68
- package/dist/components/core/ErrorBoundary.svelte +56 -56
- package/dist/components/core/ErrorBoundary.svelte.d.ts +5 -5
- package/dist/components/core/Icon.svelte +22 -11
- package/dist/components/core/ResizeHandle.svelte +1 -1
- package/dist/components/core/Tooltip.svelte +1 -7
- package/dist/components/editor/AIFocusLayer.svelte +15 -7
- package/dist/components/editor/Breadcrumbs.svelte +18 -6
- package/dist/components/editor/BreakpointLayer.svelte +51 -60
- package/dist/components/editor/CognitiveLoadMeter.svelte +4 -2
- package/dist/components/editor/CollaborativeEditor.svelte +1 -5
- package/dist/components/editor/CommandPalette.svelte +1 -4
- package/dist/components/editor/ComplexityLayer.svelte +8 -6
- package/dist/components/editor/ConflictZoneLayer.svelte +2 -8
- package/dist/components/editor/ContextLens.svelte +1 -4
- package/dist/components/editor/CustomEditor.svelte +85 -41
- package/dist/components/editor/DebugConsole.svelte +8 -17
- package/dist/components/editor/EchoCursorLayer.svelte +3 -1
- package/dist/components/editor/EditorGutter.svelte +8 -2
- package/dist/components/editor/EditorLines.svelte +6 -3
- package/dist/components/editor/EditorPane.svelte +1 -6
- package/dist/components/editor/EditorSelections.svelte +29 -11
- package/dist/components/editor/FileExplorer.svelte +26 -4
- package/dist/components/editor/FileIcon.svelte +3 -1
- package/dist/components/editor/FindReplace.svelte +16 -4
- package/dist/components/editor/GhostBracketLayer.svelte +2 -2
- package/dist/components/editor/GitBlameLayer.svelte +2 -1
- package/dist/components/editor/InlineDiagnosticsLayer.svelte +4 -13
- package/dist/components/editor/InlineDiffLayer.svelte +18 -9
- package/dist/components/editor/Minimap.svelte +16 -9
- package/dist/components/editor/PluginPreviewSandbox.svelte +3 -2
- package/dist/components/editor/ProblemsPanel.svelte +11 -35
- package/dist/components/editor/QuickActionsMenu.svelte +5 -14
- package/dist/components/editor/SnippetPalette.svelte +11 -12
- package/dist/components/editor/StructureMap.svelte +2 -1
- package/dist/components/editor/SymbolOutline.svelte +14 -19
- package/dist/components/editor/TimelineScrubber.svelte +7 -6
- package/dist/components/editor/core/complexity-analyzer.js +42 -12
- package/dist/components/editor/core/conflict-predictor.js +2 -4
- package/dist/components/editor/core/folding.d.ts +9 -0
- package/dist/components/editor/core/folding.js +40 -5
- package/dist/components/editor/core/multi-cursor.js +4 -8
- package/dist/components/editor/core/navigation.js +2 -6
- package/dist/components/editor/core/quick-actions.js +22 -17
- package/dist/components/editor/core/search.js +2 -6
- package/dist/components/editor/core/semantic-analyzer.js +1 -3
- package/dist/components/editor/core/snippet-manager.js +4 -3
- package/dist/components/editor/core/state.js +2 -2
- package/dist/components/editor/core/timeline.js +1 -3
- package/dist/components/editor/editor-input.js +9 -6
- package/dist/components/editor/editor-multicursor.js +2 -2
- package/dist/components/editor/tokenizer/languages/css.js +146 -24
- package/dist/components/editor/tokenizer/languages/go.js +76 -13
- package/dist/components/editor/tokenizer/languages/javascript.js +210 -29
- package/dist/components/editor/tokenizer/languages/python.js +116 -19
- package/dist/components/editor/tokenizer/languages/svelte.js +20 -7
- package/dist/components/layout/IDELayout.svelte +6 -2
- package/dist/components/layout/StatusBar.svelte +32 -20
- package/dist/components/lsp/AutocompleteWidget.svelte +19 -19
- package/dist/components/lsp/DiagnosticMarker.svelte +61 -52
- package/dist/components/lsp/DiagnosticsPanel.svelte +45 -27
- package/dist/components/lsp/HoverTooltip.svelte +56 -61
- package/dist/components/lsp/LSPEditor.svelte +7 -18
- package/dist/components/lsp/SignatureHelpWidget.svelte +12 -9
- package/dist/components/plugins/PluginCard.svelte +3 -13
- package/dist/components/plugins/PluginProposalForm.svelte +19 -31
- package/dist/components/vfs/LockConflictDialog.svelte +112 -45
- package/dist/components/vfs/LockIndicator.svelte +0 -1
- package/dist/components/vfs/LockOverlay.svelte +53 -53
- package/dist/components/vfs/LockOverlay.svelte.d.ts +5 -5
- package/dist/components/vfs/VersionConflictDialog.svelte +107 -77
- package/dist/services/error-handling.js +1 -7
- package/dist/services/mock-ai.js +9 -7
- package/dist/stores/agents.svelte.js +50 -10
- package/dist/stores/ai.svelte.js +66 -18
- package/dist/stores/collaboration.svelte.js +70 -14
- package/dist/stores/editor.svelte.js +50 -10
- package/dist/stores/plugin.svelte.js +60 -12
- package/dist/stores/vfs.svelte.js +77 -19
- package/dist/styles/theme.css +16 -7
- package/package.json +186 -1
|
@@ -4,28 +4,128 @@
|
|
|
4
4
|
import { createToken } from '../base';
|
|
5
5
|
// CSS properties (common ones)
|
|
6
6
|
const properties = new Set([
|
|
7
|
-
'align-content',
|
|
8
|
-
'
|
|
9
|
-
'
|
|
10
|
-
'
|
|
11
|
-
'
|
|
12
|
-
'
|
|
13
|
-
'
|
|
14
|
-
'
|
|
15
|
-
'
|
|
16
|
-
'
|
|
17
|
-
'
|
|
18
|
-
'
|
|
19
|
-
'
|
|
20
|
-
'
|
|
21
|
-
'
|
|
22
|
-
'
|
|
23
|
-
'
|
|
24
|
-
'
|
|
25
|
-
'
|
|
26
|
-
'
|
|
27
|
-
'
|
|
28
|
-
'
|
|
7
|
+
'align-content',
|
|
8
|
+
'align-items',
|
|
9
|
+
'align-self',
|
|
10
|
+
'animation',
|
|
11
|
+
'animation-delay',
|
|
12
|
+
'animation-direction',
|
|
13
|
+
'animation-duration',
|
|
14
|
+
'animation-fill-mode',
|
|
15
|
+
'animation-iteration-count',
|
|
16
|
+
'animation-name',
|
|
17
|
+
'animation-play-state',
|
|
18
|
+
'animation-timing-function',
|
|
19
|
+
'background',
|
|
20
|
+
'background-attachment',
|
|
21
|
+
'background-blend-mode',
|
|
22
|
+
'background-clip',
|
|
23
|
+
'background-color',
|
|
24
|
+
'background-image',
|
|
25
|
+
'background-origin',
|
|
26
|
+
'background-position',
|
|
27
|
+
'background-repeat',
|
|
28
|
+
'background-size',
|
|
29
|
+
'border',
|
|
30
|
+
'border-bottom',
|
|
31
|
+
'border-color',
|
|
32
|
+
'border-left',
|
|
33
|
+
'border-radius',
|
|
34
|
+
'border-right',
|
|
35
|
+
'border-style',
|
|
36
|
+
'border-top',
|
|
37
|
+
'border-width',
|
|
38
|
+
'bottom',
|
|
39
|
+
'box-shadow',
|
|
40
|
+
'box-sizing',
|
|
41
|
+
'color',
|
|
42
|
+
'content',
|
|
43
|
+
'cursor',
|
|
44
|
+
'display',
|
|
45
|
+
'filter',
|
|
46
|
+
'flex',
|
|
47
|
+
'flex-basis',
|
|
48
|
+
'flex-direction',
|
|
49
|
+
'flex-flow',
|
|
50
|
+
'flex-grow',
|
|
51
|
+
'flex-shrink',
|
|
52
|
+
'flex-wrap',
|
|
53
|
+
'float',
|
|
54
|
+
'font',
|
|
55
|
+
'font-family',
|
|
56
|
+
'font-size',
|
|
57
|
+
'font-style',
|
|
58
|
+
'font-weight',
|
|
59
|
+
'gap',
|
|
60
|
+
'grid',
|
|
61
|
+
'grid-area',
|
|
62
|
+
'grid-column',
|
|
63
|
+
'grid-gap',
|
|
64
|
+
'grid-row',
|
|
65
|
+
'grid-template',
|
|
66
|
+
'grid-template-areas',
|
|
67
|
+
'grid-template-columns',
|
|
68
|
+
'grid-template-rows',
|
|
69
|
+
'height',
|
|
70
|
+
'justify-content',
|
|
71
|
+
'justify-items',
|
|
72
|
+
'justify-self',
|
|
73
|
+
'left',
|
|
74
|
+
'letter-spacing',
|
|
75
|
+
'line-height',
|
|
76
|
+
'list-style',
|
|
77
|
+
'margin',
|
|
78
|
+
'margin-bottom',
|
|
79
|
+
'margin-left',
|
|
80
|
+
'margin-right',
|
|
81
|
+
'margin-top',
|
|
82
|
+
'max-height',
|
|
83
|
+
'max-width',
|
|
84
|
+
'min-height',
|
|
85
|
+
'min-width',
|
|
86
|
+
'object-fit',
|
|
87
|
+
'opacity',
|
|
88
|
+
'order',
|
|
89
|
+
'outline',
|
|
90
|
+
'overflow',
|
|
91
|
+
'overflow-x',
|
|
92
|
+
'overflow-y',
|
|
93
|
+
'padding',
|
|
94
|
+
'padding-bottom',
|
|
95
|
+
'padding-left',
|
|
96
|
+
'padding-right',
|
|
97
|
+
'padding-top',
|
|
98
|
+
'place-content',
|
|
99
|
+
'place-items',
|
|
100
|
+
'place-self',
|
|
101
|
+
'pointer-events',
|
|
102
|
+
'position',
|
|
103
|
+
'resize',
|
|
104
|
+
'right',
|
|
105
|
+
'row-gap',
|
|
106
|
+
'text-align',
|
|
107
|
+
'text-decoration',
|
|
108
|
+
'text-indent',
|
|
109
|
+
'text-overflow',
|
|
110
|
+
'text-shadow',
|
|
111
|
+
'text-transform',
|
|
112
|
+
'top',
|
|
113
|
+
'transform',
|
|
114
|
+
'transform-origin',
|
|
115
|
+
'transition',
|
|
116
|
+
'transition-delay',
|
|
117
|
+
'transition-duration',
|
|
118
|
+
'transition-property',
|
|
119
|
+
'transition-timing-function',
|
|
120
|
+
'user-select',
|
|
121
|
+
'vertical-align',
|
|
122
|
+
'visibility',
|
|
123
|
+
'white-space',
|
|
124
|
+
'width',
|
|
125
|
+
'word-break',
|
|
126
|
+
'word-spacing',
|
|
127
|
+
'word-wrap',
|
|
128
|
+
'z-index'
|
|
29
129
|
]);
|
|
30
130
|
export class CSSTokenizer {
|
|
31
131
|
language = 'css';
|
|
@@ -141,11 +241,33 @@ export class CSSTokenizer {
|
|
|
141
241
|
if (keywordMatch) {
|
|
142
242
|
const word = keywordMatch[0];
|
|
143
243
|
// Common CSS keywords
|
|
144
|
-
if ([
|
|
244
|
+
if ([
|
|
245
|
+
'inherit',
|
|
246
|
+
'initial',
|
|
247
|
+
'unset',
|
|
248
|
+
'revert',
|
|
249
|
+
'none',
|
|
250
|
+
'auto',
|
|
251
|
+
'transparent',
|
|
252
|
+
'currentColor',
|
|
253
|
+
'important'
|
|
254
|
+
].includes(word)) {
|
|
145
255
|
return createToken('keyword', word, pos);
|
|
146
256
|
}
|
|
147
257
|
// Color names
|
|
148
|
-
if ([
|
|
258
|
+
if ([
|
|
259
|
+
'red',
|
|
260
|
+
'blue',
|
|
261
|
+
'green',
|
|
262
|
+
'white',
|
|
263
|
+
'black',
|
|
264
|
+
'yellow',
|
|
265
|
+
'orange',
|
|
266
|
+
'purple',
|
|
267
|
+
'pink',
|
|
268
|
+
'gray',
|
|
269
|
+
'grey'
|
|
270
|
+
].includes(word)) {
|
|
149
271
|
return createToken('constant', word, pos);
|
|
150
272
|
}
|
|
151
273
|
return createToken('text', word, pos);
|
|
@@ -4,25 +4,88 @@
|
|
|
4
4
|
import { createToken } from '../base';
|
|
5
5
|
// Go keywords
|
|
6
6
|
const keywords = new Set([
|
|
7
|
-
'break',
|
|
8
|
-
'
|
|
9
|
-
'
|
|
7
|
+
'break',
|
|
8
|
+
'case',
|
|
9
|
+
'chan',
|
|
10
|
+
'const',
|
|
11
|
+
'continue',
|
|
12
|
+
'default',
|
|
13
|
+
'defer',
|
|
14
|
+
'else',
|
|
15
|
+
'fallthrough',
|
|
16
|
+
'for',
|
|
17
|
+
'func',
|
|
18
|
+
'go',
|
|
19
|
+
'goto',
|
|
20
|
+
'if',
|
|
21
|
+
'import',
|
|
22
|
+
'interface',
|
|
23
|
+
'map',
|
|
24
|
+
'package',
|
|
25
|
+
'range',
|
|
26
|
+
'return',
|
|
27
|
+
'select',
|
|
28
|
+
'struct',
|
|
29
|
+
'switch',
|
|
30
|
+
'type',
|
|
31
|
+
'var'
|
|
10
32
|
]);
|
|
11
33
|
const controlKeywords = new Set([
|
|
12
|
-
'break',
|
|
13
|
-
'
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
'
|
|
34
|
+
'break',
|
|
35
|
+
'case',
|
|
36
|
+
'continue',
|
|
37
|
+
'default',
|
|
38
|
+
'defer',
|
|
39
|
+
'else',
|
|
40
|
+
'fallthrough',
|
|
41
|
+
'for',
|
|
42
|
+
'go',
|
|
43
|
+
'goto',
|
|
44
|
+
'if',
|
|
45
|
+
'range',
|
|
46
|
+
'return',
|
|
47
|
+
'select',
|
|
48
|
+
'switch'
|
|
17
49
|
]);
|
|
50
|
+
const builtins = new Set(['true', 'false', 'nil', 'iota']);
|
|
18
51
|
const builtinFunctions = new Set([
|
|
19
|
-
'append',
|
|
20
|
-
'
|
|
52
|
+
'append',
|
|
53
|
+
'cap',
|
|
54
|
+
'close',
|
|
55
|
+
'complex',
|
|
56
|
+
'copy',
|
|
57
|
+
'delete',
|
|
58
|
+
'imag',
|
|
59
|
+
'len',
|
|
60
|
+
'make',
|
|
61
|
+
'new',
|
|
62
|
+
'panic',
|
|
63
|
+
'print',
|
|
64
|
+
'println',
|
|
65
|
+
'real',
|
|
66
|
+
'recover'
|
|
21
67
|
]);
|
|
22
68
|
const builtinTypes = new Set([
|
|
23
|
-
'bool',
|
|
24
|
-
'
|
|
25
|
-
'
|
|
69
|
+
'bool',
|
|
70
|
+
'byte',
|
|
71
|
+
'complex64',
|
|
72
|
+
'complex128',
|
|
73
|
+
'error',
|
|
74
|
+
'float32',
|
|
75
|
+
'float64',
|
|
76
|
+
'int',
|
|
77
|
+
'int8',
|
|
78
|
+
'int16',
|
|
79
|
+
'int32',
|
|
80
|
+
'int64',
|
|
81
|
+
'rune',
|
|
82
|
+
'string',
|
|
83
|
+
'uint',
|
|
84
|
+
'uint8',
|
|
85
|
+
'uint16',
|
|
86
|
+
'uint32',
|
|
87
|
+
'uint64',
|
|
88
|
+
'uintptr'
|
|
26
89
|
]);
|
|
27
90
|
export class GoTokenizer {
|
|
28
91
|
language = 'go';
|
|
@@ -4,48 +4,205 @@
|
|
|
4
4
|
import { createToken } from '../base';
|
|
5
5
|
// JavaScript/TypeScript keywords
|
|
6
6
|
const keywords = new Set([
|
|
7
|
-
'await',
|
|
8
|
-
'
|
|
9
|
-
'
|
|
10
|
-
'
|
|
11
|
-
'
|
|
7
|
+
'await',
|
|
8
|
+
'break',
|
|
9
|
+
'case',
|
|
10
|
+
'catch',
|
|
11
|
+
'class',
|
|
12
|
+
'const',
|
|
13
|
+
'continue',
|
|
14
|
+
'debugger',
|
|
15
|
+
'default',
|
|
16
|
+
'delete',
|
|
17
|
+
'do',
|
|
18
|
+
'else',
|
|
19
|
+
'enum',
|
|
20
|
+
'export',
|
|
21
|
+
'extends',
|
|
22
|
+
'finally',
|
|
23
|
+
'for',
|
|
24
|
+
'function',
|
|
25
|
+
'if',
|
|
26
|
+
'import',
|
|
27
|
+
'in',
|
|
28
|
+
'instanceof',
|
|
29
|
+
'let',
|
|
30
|
+
'new',
|
|
31
|
+
'of',
|
|
32
|
+
'return',
|
|
33
|
+
'static',
|
|
34
|
+
'super',
|
|
35
|
+
'switch',
|
|
36
|
+
'this',
|
|
37
|
+
'throw',
|
|
38
|
+
'try',
|
|
39
|
+
'typeof',
|
|
40
|
+
'var',
|
|
41
|
+
'void',
|
|
42
|
+
'while',
|
|
43
|
+
'with',
|
|
44
|
+
'yield',
|
|
45
|
+
'async',
|
|
46
|
+
'from',
|
|
47
|
+
'as',
|
|
48
|
+
'get',
|
|
49
|
+
'set'
|
|
12
50
|
]);
|
|
13
51
|
// TypeScript-specific keywords
|
|
14
52
|
const tsKeywords = new Set([
|
|
15
|
-
'abstract',
|
|
16
|
-
'
|
|
17
|
-
'
|
|
18
|
-
'
|
|
53
|
+
'abstract',
|
|
54
|
+
'any',
|
|
55
|
+
'as',
|
|
56
|
+
'asserts',
|
|
57
|
+
'bigint',
|
|
58
|
+
'boolean',
|
|
59
|
+
'declare',
|
|
60
|
+
'infer',
|
|
61
|
+
'interface',
|
|
62
|
+
'is',
|
|
63
|
+
'keyof',
|
|
64
|
+
'module',
|
|
65
|
+
'namespace',
|
|
66
|
+
'never',
|
|
67
|
+
'null',
|
|
68
|
+
'number',
|
|
69
|
+
'object',
|
|
70
|
+
'override',
|
|
71
|
+
'private',
|
|
72
|
+
'protected',
|
|
73
|
+
'public',
|
|
74
|
+
'readonly',
|
|
75
|
+
'require',
|
|
76
|
+
'string',
|
|
77
|
+
'symbol',
|
|
78
|
+
'type',
|
|
79
|
+
'undefined',
|
|
80
|
+
'unique',
|
|
81
|
+
'unknown',
|
|
82
|
+
'void'
|
|
19
83
|
]);
|
|
20
84
|
// Control flow keywords
|
|
21
85
|
const controlKeywords = new Set([
|
|
22
|
-
'if',
|
|
23
|
-
'
|
|
86
|
+
'if',
|
|
87
|
+
'else',
|
|
88
|
+
'for',
|
|
89
|
+
'while',
|
|
90
|
+
'do',
|
|
91
|
+
'switch',
|
|
92
|
+
'case',
|
|
93
|
+
'default',
|
|
94
|
+
'break',
|
|
95
|
+
'continue',
|
|
96
|
+
'return',
|
|
97
|
+
'throw',
|
|
98
|
+
'try',
|
|
99
|
+
'catch',
|
|
100
|
+
'finally',
|
|
101
|
+
'await',
|
|
102
|
+
'yield'
|
|
24
103
|
]);
|
|
25
104
|
// Built-in constants
|
|
26
105
|
const builtins = new Set(['true', 'false', 'null', 'undefined', 'NaN', 'Infinity']);
|
|
27
106
|
// Built-in type names
|
|
28
107
|
const builtinTypes = new Set([
|
|
29
|
-
'Array',
|
|
30
|
-
'
|
|
31
|
-
'
|
|
32
|
-
'
|
|
108
|
+
'Array',
|
|
109
|
+
'Object',
|
|
110
|
+
'String',
|
|
111
|
+
'Number',
|
|
112
|
+
'Boolean',
|
|
113
|
+
'Function',
|
|
114
|
+
'Symbol',
|
|
115
|
+
'Promise',
|
|
116
|
+
'Map',
|
|
117
|
+
'Set',
|
|
118
|
+
'WeakMap',
|
|
119
|
+
'WeakSet',
|
|
120
|
+
'Date',
|
|
121
|
+
'RegExp',
|
|
122
|
+
'Error',
|
|
123
|
+
'TypeError',
|
|
124
|
+
'ReferenceError',
|
|
125
|
+
'SyntaxError',
|
|
126
|
+
'JSON',
|
|
127
|
+
'Math',
|
|
128
|
+
'console',
|
|
129
|
+
'window',
|
|
130
|
+
'document',
|
|
131
|
+
'globalThis',
|
|
132
|
+
'Buffer',
|
|
133
|
+
'process'
|
|
33
134
|
]);
|
|
34
135
|
/**
|
|
35
136
|
* Tokens after which a regex literal can appear (expression start context)
|
|
36
137
|
*/
|
|
37
138
|
const REGEX_VALID_AFTER = new Set([
|
|
38
139
|
// Keywords that expect expressions
|
|
39
|
-
'return',
|
|
40
|
-
'
|
|
140
|
+
'return',
|
|
141
|
+
'throw',
|
|
142
|
+
'case',
|
|
143
|
+
'in',
|
|
144
|
+
'of',
|
|
145
|
+
'typeof',
|
|
146
|
+
'instanceof',
|
|
147
|
+
'void',
|
|
148
|
+
'delete',
|
|
149
|
+
'new',
|
|
150
|
+
'await',
|
|
151
|
+
'yield',
|
|
152
|
+
'default',
|
|
153
|
+
'extends',
|
|
154
|
+
'else',
|
|
155
|
+
'do',
|
|
41
156
|
// Operators
|
|
42
|
-
'=',
|
|
43
|
-
'
|
|
44
|
-
'
|
|
45
|
-
'
|
|
46
|
-
'
|
|
157
|
+
'=',
|
|
158
|
+
'==',
|
|
159
|
+
'===',
|
|
160
|
+
'!=',
|
|
161
|
+
'!==',
|
|
162
|
+
'<',
|
|
163
|
+
'>',
|
|
164
|
+
'<=',
|
|
165
|
+
'>=',
|
|
166
|
+
'+',
|
|
167
|
+
'-',
|
|
168
|
+
'*',
|
|
169
|
+
'/',
|
|
170
|
+
'%',
|
|
171
|
+
'**',
|
|
172
|
+
'&',
|
|
173
|
+
'|',
|
|
174
|
+
'^',
|
|
175
|
+
'~',
|
|
176
|
+
'!',
|
|
177
|
+
'&&',
|
|
178
|
+
'||',
|
|
179
|
+
'??',
|
|
180
|
+
'?',
|
|
181
|
+
':',
|
|
182
|
+
',',
|
|
183
|
+
';',
|
|
184
|
+
'+=',
|
|
185
|
+
'-=',
|
|
186
|
+
'*=',
|
|
187
|
+
'/=',
|
|
188
|
+
'%=',
|
|
189
|
+
'**=',
|
|
190
|
+
'&=',
|
|
191
|
+
'|=',
|
|
192
|
+
'^=',
|
|
193
|
+
'&&=',
|
|
194
|
+
'||=',
|
|
195
|
+
'??=',
|
|
196
|
+
'<<',
|
|
197
|
+
'>>',
|
|
198
|
+
'>>>',
|
|
199
|
+
'<<=',
|
|
200
|
+
'>>=',
|
|
201
|
+
'>>>=',
|
|
47
202
|
// Opening brackets
|
|
48
|
-
'(',
|
|
203
|
+
'(',
|
|
204
|
+
'[',
|
|
205
|
+
'{',
|
|
49
206
|
// Arrow
|
|
50
207
|
'=>'
|
|
51
208
|
]);
|
|
@@ -54,8 +211,11 @@ const REGEX_VALID_AFTER = new Set([
|
|
|
54
211
|
*/
|
|
55
212
|
const DIVISION_VALID_AFTER = new Set([
|
|
56
213
|
// These token types indicate an expression just ended
|
|
57
|
-
')',
|
|
58
|
-
'
|
|
214
|
+
')',
|
|
215
|
+
']',
|
|
216
|
+
'}', // Closing brackets
|
|
217
|
+
'++',
|
|
218
|
+
'--' // Postfix operators
|
|
59
219
|
]);
|
|
60
220
|
export class JavaScriptTokenizer {
|
|
61
221
|
language;
|
|
@@ -65,8 +225,12 @@ export class JavaScriptTokenizer {
|
|
|
65
225
|
this.isTypeScript = options.typescript ?? false;
|
|
66
226
|
this.isJSX = options.jsx ?? false;
|
|
67
227
|
this.language = this.isTypeScript
|
|
68
|
-
?
|
|
69
|
-
|
|
228
|
+
? this.isJSX
|
|
229
|
+
? 'tsx'
|
|
230
|
+
: 'typescript'
|
|
231
|
+
: this.isJSX
|
|
232
|
+
? 'jsx'
|
|
233
|
+
: 'javascript';
|
|
70
234
|
}
|
|
71
235
|
getInitialState() {
|
|
72
236
|
return {
|
|
@@ -239,7 +403,11 @@ export class JavaScriptTokenizer {
|
|
|
239
403
|
if (keywords.has(word)) {
|
|
240
404
|
if (controlKeywords.has(word))
|
|
241
405
|
return 'keyword.control';
|
|
242
|
-
if (word === 'function' ||
|
|
406
|
+
if (word === 'function' ||
|
|
407
|
+
word === 'class' ||
|
|
408
|
+
word === 'const' ||
|
|
409
|
+
word === 'let' ||
|
|
410
|
+
word === 'var') {
|
|
243
411
|
return 'keyword.definition';
|
|
244
412
|
}
|
|
245
413
|
if (word === 'import' || word === 'export' || word === 'from' || word === 'as') {
|
|
@@ -253,7 +421,20 @@ export class JavaScriptTokenizer {
|
|
|
253
421
|
return 'keyword.definition';
|
|
254
422
|
}
|
|
255
423
|
// Type keywords like 'string', 'number', 'boolean' etc
|
|
256
|
-
if ([
|
|
424
|
+
if ([
|
|
425
|
+
'string',
|
|
426
|
+
'number',
|
|
427
|
+
'boolean',
|
|
428
|
+
'any',
|
|
429
|
+
'unknown',
|
|
430
|
+
'never',
|
|
431
|
+
'void',
|
|
432
|
+
'null',
|
|
433
|
+
'undefined',
|
|
434
|
+
'object',
|
|
435
|
+
'symbol',
|
|
436
|
+
'bigint'
|
|
437
|
+
].includes(word)) {
|
|
257
438
|
return 'type.builtin';
|
|
258
439
|
}
|
|
259
440
|
return 'keyword.storage';
|