diff options
Diffstat (limited to 'subprojects/frontend')
-rw-r--r-- | subprojects/frontend/package.json | 120 | ||||
-rw-r--r-- | subprojects/frontend/src/editor/EditorParent.ts | 32 | ||||
-rw-r--r-- | subprojects/frontend/src/editor/EditorStore.ts | 40 | ||||
-rw-r--r-- | subprojects/frontend/src/editor/findOccurrences.ts | 3 | ||||
-rw-r--r-- | subprojects/frontend/src/editor/semanticHighlighting.ts | 5 | ||||
-rw-r--r-- | subprojects/frontend/src/index.tsx | 13 | ||||
-rw-r--r-- | subprojects/frontend/src/language/folding.ts | 4 | ||||
-rw-r--r-- | subprojects/frontend/src/language/indentation.ts | 2 | ||||
-rw-r--r-- | subprojects/frontend/src/language/problemLanguageSupport.ts | 2 | ||||
-rw-r--r-- | subprojects/frontend/src/theme/ThemeProvider.tsx | 4 | ||||
-rw-r--r-- | subprojects/frontend/src/xtext/ContentAssistService.ts | 8 | ||||
-rw-r--r-- | subprojects/frontend/src/xtext/xtextMessages.ts | 10 | ||||
-rw-r--r-- | subprojects/frontend/src/xtext/xtextServiceResults.ts | 16 |
13 files changed, 133 insertions, 126 deletions
diff --git a/subprojects/frontend/package.json b/subprojects/frontend/package.json index 1edd7f34..455b8b67 100644 --- a/subprojects/frontend/package.json +++ b/subprojects/frontend/package.json | |||
@@ -24,79 +24,71 @@ | |||
24 | }, | 24 | }, |
25 | "homepage": "https://refinery.tools", | 25 | "homepage": "https://refinery.tools", |
26 | "devDependencies": { | 26 | "devDependencies": { |
27 | "@babel/core": "^7.16.5", | 27 | "@babel/core": "^7.18.9", |
28 | "@babel/plugin-transform-runtime": "^7.16.5", | 28 | "@babel/plugin-transform-runtime": "^7.18.9", |
29 | "@babel/preset-env": "^7.16.5", | 29 | "@babel/preset-env": "^7.18.9", |
30 | "@babel/preset-react": "^7.16.5", | 30 | "@babel/preset-react": "^7.18.6", |
31 | "@babel/preset-typescript": "^7.16.5", | 31 | "@babel/preset-typescript": "^7.18.6", |
32 | "@lezer/generator": "^0.15.2", | 32 | "@lezer/generator": "^1.1.0", |
33 | "@principalstudio/html-webpack-inject-preload": "^1.2.7", | 33 | "@principalstudio/html-webpack-inject-preload": "^1.2.7", |
34 | "@types/react": "^17.0.37", | 34 | "@types/react": "^18.0.15", |
35 | "@types/react-dom": "^17.0.11", | 35 | "@types/react-dom": "^18.0.6", |
36 | "@typescript-eslint/eslint-plugin": "^5.7.0", | 36 | "@typescript-eslint/eslint-plugin": "^5.31.0", |
37 | "@typescript-eslint/parser": "^5.7.0", | 37 | "@typescript-eslint/parser": "^5.31.0", |
38 | "babel-loader": "^8.2.3", | 38 | "babel-loader": "^8.2.5", |
39 | "css-loader": "^6.5.1", | 39 | "css-loader": "^6.7.1", |
40 | "eslint": "^8.4.1", | 40 | "eslint": "^8.20.0", |
41 | "eslint-config-airbnb": "^19.0.2", | 41 | "eslint-config-airbnb": "^19.0.4", |
42 | "eslint-config-airbnb-typescript": "^16.1.0", | 42 | "eslint-config-airbnb-typescript": "^17.0.0", |
43 | "eslint-import-resolver-node": "^0.3.6", | 43 | "eslint-import-resolver-node": "^0.3.6", |
44 | "eslint-plugin-import": "^2.25.3", | 44 | "eslint-plugin-import": "^2.26.0", |
45 | "eslint-plugin-jsx-a11y": "^6.5.1", | 45 | "eslint-plugin-jsx-a11y": "^6.6.1", |
46 | "eslint-plugin-react": "^7.27.1", | 46 | "eslint-plugin-react": "^7.30.1", |
47 | "eslint-plugin-react-hooks": "^4.3.0", | 47 | "eslint-plugin-react-hooks": "^4.6.0", |
48 | "html-webpack-plugin": "^5.5.0", | 48 | "html-webpack-plugin": "^5.5.0", |
49 | "image-webpack-loader": "^8.0.1", | 49 | "image-webpack-loader": "^8.1.0", |
50 | "mini-css-extract-plugin": "^2.4.5", | 50 | "mini-css-extract-plugin": "^2.6.1", |
51 | "postcss": "^8.4.5", | 51 | "postcss": "^8.4.14", |
52 | "postcss-scss": "^4.0.2", | 52 | "postcss-scss": "^4.0.4", |
53 | "sass": "^1.45.0", | 53 | "sass": "^1.54.0", |
54 | "sass-loader": "^12.4.0", | 54 | "sass-loader": "^13.0.2", |
55 | "style-loader": "^3.3.1", | 55 | "style-loader": "^3.3.1", |
56 | "stylelint": "^14.1.0", | 56 | "stylelint": "^14.9.1", |
57 | "stylelint-config-recommended-scss": "^5.0.2", | 57 | "stylelint-config-recommended-scss": "^7.0.0", |
58 | "stylelint-scss": "^4.0.1", | 58 | "stylelint-scss": "^4.3.0", |
59 | "typescript": "~4.5.4", | 59 | "typescript": "~4.7.4", |
60 | "webpack": "^5.65.0", | 60 | "webpack": "^5.74.0", |
61 | "webpack-cli": "^4.9.1", | 61 | "webpack-cli": "^4.10.0", |
62 | "webpack-dev-server": "^4.6.0", | 62 | "webpack-dev-server": "^4.9.3", |
63 | "webpack-subresource-integrity": "^5.0.0" | 63 | "webpack-subresource-integrity": "^5.1.0" |
64 | }, | 64 | }, |
65 | "dependencies": { | 65 | "dependencies": { |
66 | "@babel/runtime": "^7.16.5", | 66 | "@babel/runtime": "^7.18.9", |
67 | "@codemirror/autocomplete": "^0.19.9", | 67 | "@codemirror/autocomplete": "^6.1.0", |
68 | "@codemirror/closebrackets": "^0.19.0", | 68 | "@codemirror/commands": "^6.0.1", |
69 | "@codemirror/commands": "^0.19.6", | 69 | "@codemirror/language": "^6.2.1", |
70 | "@codemirror/comment": "^0.19.0", | 70 | "@codemirror/lint": "^6.0.0", |
71 | "@codemirror/fold": "^0.19.2", | 71 | "@codemirror/search": "^6.0.1", |
72 | "@codemirror/gutter": "^0.19.9", | 72 | "@codemirror/state": "^6.1.0", |
73 | "@codemirror/highlight": "^0.19.6", | 73 | "@codemirror/view": "^6.1.1", |
74 | "@codemirror/history": "^0.19.0", | 74 | "@emotion/react": "^11.9.3", |
75 | "@codemirror/language": "^0.19.7", | 75 | "@emotion/styled": "^11.9.3", |
76 | "@codemirror/lint": "^0.19.3", | 76 | "@fontsource/jetbrains-mono": "^4.5.9", |
77 | "@codemirror/matchbrackets": "^0.19.3", | 77 | "@fontsource/roboto": "^4.5.7", |
78 | "@codemirror/rangeset": "^0.19.2", | 78 | "@lezer/common": "^1.0.0", |
79 | "@codemirror/rectangular-selection": "^0.19.1", | 79 | "@lezer/highlight": "^1.0.0", |
80 | "@codemirror/search": "^0.19.4", | 80 | "@lezer/lr": "^1.2.0", |
81 | "@codemirror/state": "^0.19.6", | 81 | "@mui/icons-material": "5.8.4", |
82 | "@codemirror/view": "^0.19.31", | 82 | "@mui/material": "5.9.2", |
83 | "@emotion/react": "^11.7.1", | ||
84 | "@emotion/styled": "^11.6.0", | ||
85 | "@fontsource/jetbrains-mono": "^4.5.0", | ||
86 | "@fontsource/roboto": "^4.5.1", | ||
87 | "@lezer/common": "^0.15.10", | ||
88 | "@lezer/lr": "^0.15.5", | ||
89 | "@mui/icons-material": "5.2.1", | ||
90 | "@mui/material": "5.2.3", | ||
91 | "ansi-styles": "^6.1.0", | 83 | "ansi-styles": "^6.1.0", |
92 | "escape-string-regexp": "^5.0.0", | 84 | "escape-string-regexp": "^5.0.0", |
93 | "loglevel": "^1.8.0", | 85 | "loglevel": "^1.8.0", |
94 | "loglevel-plugin-prefix": "^0.8.4", | 86 | "loglevel-plugin-prefix": "^0.8.4", |
95 | "mobx": "^6.3.8", | 87 | "mobx": "^6.6.1", |
96 | "mobx-react-lite": "^3.2.2", | 88 | "mobx-react-lite": "^3.4.0", |
97 | "nanoid": "^3.1.30", | 89 | "nanoid": "^4.0.0", |
98 | "react": "^17.0.2", | 90 | "react": "^18.2.0", |
99 | "react-dom": "^17.0.2", | 91 | "react-dom": "^18.2.0", |
100 | "zod": "^3.11.6" | 92 | "zod": "^3.17.10" |
101 | } | 93 | } |
102 | } | 94 | } |
diff --git a/subprojects/frontend/src/editor/EditorParent.ts b/subprojects/frontend/src/editor/EditorParent.ts index 94ca24ea..9aaf541a 100644 --- a/subprojects/frontend/src/editor/EditorParent.ts +++ b/subprojects/frontend/src/editor/EditorParent.ts | |||
@@ -119,48 +119,48 @@ export const EditorParent = styled('div')(({ theme }) => { | |||
119 | borderColor: theme.palette.text.disabled, | 119 | borderColor: theme.palette.text.disabled, |
120 | color: theme.palette.text.secondary, | 120 | color: theme.palette.text.secondary, |
121 | }, | 121 | }, |
122 | '.cmt-comment': { | 122 | '.tok-comment': { |
123 | fontStyle: 'italic', | 123 | fontStyle: 'italic', |
124 | color: theme.palette.text.disabled, | 124 | color: theme.palette.text.disabled, |
125 | }, | 125 | }, |
126 | '.cmt-number': { | 126 | '.tok-number': { |
127 | color: '#6188a6', | 127 | color: '#6188a6', |
128 | }, | 128 | }, |
129 | '.cmt-string': { | 129 | '.tok-string': { |
130 | color: theme.palette.secondary.dark, | 130 | color: theme.palette.secondary.dark, |
131 | }, | 131 | }, |
132 | '.cmt-keyword': { | 132 | '.tok-keyword': { |
133 | color: theme.palette.primary.main, | 133 | color: theme.palette.primary.main, |
134 | }, | 134 | }, |
135 | '.cmt-typeName, .cmt-macroName, .cmt-atom': { | 135 | '.tok-typeName, .tok-macroName, .tok-atom': { |
136 | color: theme.palette.text.primary, | 136 | color: theme.palette.text.primary, |
137 | }, | 137 | }, |
138 | '.cmt-variableName': { | 138 | '.tok-variableName': { |
139 | color: '#c8ae9d', | 139 | color: '#c8ae9d', |
140 | }, | 140 | }, |
141 | '.cmt-problem-node': { | 141 | '.tok-problem-node': { |
142 | '&, & .cmt-variableName': { | 142 | '&, & .tok-variableName': { |
143 | color: theme.palette.text.secondary, | 143 | color: theme.palette.text.secondary, |
144 | }, | 144 | }, |
145 | }, | 145 | }, |
146 | '.cmt-problem-individual': { | 146 | '.tok-problem-individual': { |
147 | '&, & .cmt-variableName': { | 147 | '&, & .tok-variableName': { |
148 | color: theme.palette.text.primary, | 148 | color: theme.palette.text.primary, |
149 | }, | 149 | }, |
150 | }, | 150 | }, |
151 | '.cmt-problem-abstract, .cmt-problem-new': { | 151 | '.tok-problem-abstract, .tok-problem-new': { |
152 | fontStyle: 'italic', | 152 | fontStyle: 'italic', |
153 | }, | 153 | }, |
154 | '.cmt-problem-containment': { | 154 | '.tok-problem-containment': { |
155 | fontWeight: 700, | 155 | fontWeight: 700, |
156 | }, | 156 | }, |
157 | '.cmt-problem-error': { | 157 | '.tok-problem-error': { |
158 | '&, & .cmt-typeName': { | 158 | '&, & .tok-typeName': { |
159 | color: theme.palette.error.main, | 159 | color: theme.palette.error.main, |
160 | }, | 160 | }, |
161 | }, | 161 | }, |
162 | '.cmt-problem-builtin': { | 162 | '.tok-problem-builtin': { |
163 | '&, & .cmt-typeName, & .cmt-atom, & .cmt-variableName': { | 163 | '&, & .tok-typeName, & .tok-atom, & .tok-variableName': { |
164 | color: theme.palette.primary.main, | 164 | color: theme.palette.primary.main, |
165 | fontWeight: 400, | 165 | fontWeight: 400, |
166 | fontStyle: 'normal', | 166 | fontStyle: 'normal', |
diff --git a/subprojects/frontend/src/editor/EditorStore.ts b/subprojects/frontend/src/editor/EditorStore.ts index 5760de28..0f4d2936 100644 --- a/subprojects/frontend/src/editor/EditorStore.ts +++ b/subprojects/frontend/src/editor/EditorStore.ts | |||
@@ -1,27 +1,32 @@ | |||
1 | import { autocompletion, completionKeymap } from '@codemirror/autocomplete'; | ||
2 | import { closeBrackets, closeBracketsKeymap } from '@codemirror/closebrackets'; | ||
3 | import { defaultKeymap, indentWithTab } from '@codemirror/commands'; | ||
4 | import { commentKeymap } from '@codemirror/comment'; | ||
5 | import { foldGutter, foldKeymap } from '@codemirror/fold'; | ||
6 | import { highlightActiveLineGutter, lineNumbers } from '@codemirror/gutter'; | ||
7 | import { classHighlightStyle } from '@codemirror/highlight'; | ||
8 | import { | 1 | import { |
2 | closeBrackets, | ||
3 | closeBracketsKeymap, | ||
4 | autocompletion, | ||
5 | completionKeymap, | ||
6 | } from '@codemirror/autocomplete'; | ||
7 | import { | ||
8 | defaultKeymap, | ||
9 | history, | 9 | history, |
10 | historyKeymap, | 10 | historyKeymap, |
11 | indentWithTab, | ||
11 | redo, | 12 | redo, |
12 | redoDepth, | 13 | redoDepth, |
13 | undo, | 14 | undo, |
14 | undoDepth, | 15 | undoDepth, |
15 | } from '@codemirror/history'; | 16 | } from '@codemirror/commands'; |
16 | import { indentOnInput } from '@codemirror/language'; | 17 | import { |
18 | bracketMatching, | ||
19 | foldGutter, | ||
20 | foldKeymap, | ||
21 | indentOnInput, | ||
22 | syntaxHighlighting, | ||
23 | } from '@codemirror/language'; | ||
17 | import { | 24 | import { |
18 | Diagnostic, | 25 | Diagnostic, |
19 | lintKeymap, | 26 | lintKeymap, |
20 | setDiagnostics, | 27 | setDiagnostics, |
21 | } from '@codemirror/lint'; | 28 | } from '@codemirror/lint'; |
22 | import { bracketMatching } from '@codemirror/matchbrackets'; | 29 | import { search, searchKeymap } from '@codemirror/search'; |
23 | import { rectangularSelection } from '@codemirror/rectangular-selection'; | ||
24 | import { searchConfig, searchKeymap } from '@codemirror/search'; | ||
25 | import { | 30 | import { |
26 | EditorState, | 31 | EditorState, |
27 | StateCommand, | 32 | StateCommand, |
@@ -33,9 +38,13 @@ import { | |||
33 | drawSelection, | 38 | drawSelection, |
34 | EditorView, | 39 | EditorView, |
35 | highlightActiveLine, | 40 | highlightActiveLine, |
41 | highlightActiveLineGutter, | ||
36 | highlightSpecialChars, | 42 | highlightSpecialChars, |
37 | keymap, | 43 | keymap, |
44 | lineNumbers, | ||
45 | rectangularSelection, | ||
38 | } from '@codemirror/view'; | 46 | } from '@codemirror/view'; |
47 | import { classHighlighter } from '@lezer/highlight'; | ||
39 | import { | 48 | import { |
40 | makeAutoObservable, | 49 | makeAutoObservable, |
41 | observable, | 50 | observable, |
@@ -91,7 +100,6 @@ export class EditorStore { | |||
91 | (context) => this.client.contentAssist(context), | 100 | (context) => this.client.contentAssist(context), |
92 | ], | 101 | ], |
93 | }), | 102 | }), |
94 | classHighlightStyle.extension, | ||
95 | closeBrackets(), | 103 | closeBrackets(), |
96 | bracketMatching(), | 104 | bracketMatching(), |
97 | drawSelection(), | 105 | drawSelection(), |
@@ -106,10 +114,11 @@ export class EditorStore { | |||
106 | history(), | 114 | history(), |
107 | indentOnInput(), | 115 | indentOnInput(), |
108 | rectangularSelection(), | 116 | rectangularSelection(), |
109 | searchConfig({ | 117 | search({ |
110 | top: true, | 118 | top: true, |
111 | matchCase: true, | 119 | caseSensitive: true, |
112 | }), | 120 | }), |
121 | syntaxHighlighting(classHighlighter), | ||
113 | semanticHighlighting, | 122 | semanticHighlighting, |
114 | // We add the gutters to `extensions` in the order we want them to appear. | 123 | // We add the gutters to `extensions` in the order we want them to appear. |
115 | lineNumbers(), | 124 | lineNumbers(), |
@@ -117,7 +126,6 @@ export class EditorStore { | |||
117 | keymap.of([ | 126 | keymap.of([ |
118 | { key: 'Mod-Shift-f', run: () => this.formatText() }, | 127 | { key: 'Mod-Shift-f', run: () => this.formatText() }, |
119 | ...closeBracketsKeymap, | 128 | ...closeBracketsKeymap, |
120 | ...commentKeymap, | ||
121 | ...completionKeymap, | 129 | ...completionKeymap, |
122 | ...foldKeymap, | 130 | ...foldKeymap, |
123 | ...historyKeymap, | 131 | ...historyKeymap, |
diff --git a/subprojects/frontend/src/editor/findOccurrences.ts b/subprojects/frontend/src/editor/findOccurrences.ts index 92102746..c4a4e8ec 100644 --- a/subprojects/frontend/src/editor/findOccurrences.ts +++ b/subprojects/frontend/src/editor/findOccurrences.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { Range, RangeSet } from '@codemirror/rangeset'; | 1 | import { Range, RangeSet, type TransactionSpec } from '@codemirror/state'; |
2 | import type { TransactionSpec } from '@codemirror/state'; | ||
3 | import { Decoration } from '@codemirror/view'; | 2 | import { Decoration } from '@codemirror/view'; |
4 | 3 | ||
5 | import { decorationSetExtension } from './decorationSetExtension'; | 4 | import { decorationSetExtension } from './decorationSetExtension'; |
diff --git a/subprojects/frontend/src/editor/semanticHighlighting.ts b/subprojects/frontend/src/editor/semanticHighlighting.ts index 2aed421b..a5d0af7a 100644 --- a/subprojects/frontend/src/editor/semanticHighlighting.ts +++ b/subprojects/frontend/src/editor/semanticHighlighting.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import { RangeSet } from '@codemirror/rangeset'; | 1 | import { RangeSet, type TransactionSpec } from '@codemirror/state'; |
2 | import type { TransactionSpec } from '@codemirror/state'; | ||
3 | import { Decoration } from '@codemirror/view'; | 2 | import { Decoration } from '@codemirror/view'; |
4 | 3 | ||
5 | import { decorationSetExtension } from './decorationSetExtension'; | 4 | import { decorationSetExtension } from './decorationSetExtension'; |
@@ -16,7 +15,7 @@ const [setSemanticHighlightingInternal, semanticHighlighting] = decorationSetExt | |||
16 | 15 | ||
17 | export function setSemanticHighlighting(ranges: IHighlightRange[]): TransactionSpec { | 16 | export function setSemanticHighlighting(ranges: IHighlightRange[]): TransactionSpec { |
18 | const rangeSet = RangeSet.of(ranges.map(({ from, to, classes }) => Decoration.mark({ | 17 | const rangeSet = RangeSet.of(ranges.map(({ from, to, classes }) => Decoration.mark({ |
19 | class: classes.map((c) => `cmt-problem-${c}`).join(' '), | 18 | class: classes.map((c) => `tok-problem-${c}`).join(' '), |
20 | }).range(from, to)), true); | 19 | }).range(from, to)), true); |
21 | return setSemanticHighlightingInternal(rangeSet); | 20 | return setSemanticHighlightingInternal(rangeSet); |
22 | } | 21 | } |
diff --git a/subprojects/frontend/src/index.tsx b/subprojects/frontend/src/index.tsx index 15b26adb..6cdbbd64 100644 --- a/subprojects/frontend/src/index.tsx +++ b/subprojects/frontend/src/index.tsx | |||
@@ -1,13 +1,16 @@ | |||
1 | import React from 'react'; | 1 | import React from 'react'; |
2 | import { render } from 'react-dom'; | 2 | import { createRoot } from 'react-dom/client'; |
3 | import CssBaseline from '@mui/material/CssBaseline'; | 3 | import CssBaseline from '@mui/material/CssBaseline'; |
4 | 4 | ||
5 | import { App } from './App'; | 5 | import { App } from './App'; |
6 | import { RootStore, RootStoreProvider } from './RootStore'; | 6 | import { RootStore, RootStoreProvider } from './RootStore'; |
7 | import { ThemeProvider } from './theme/ThemeProvider'; | 7 | import { ThemeProvider } from './theme/ThemeProvider'; |
8 | import { getLogger } from './utils/logger'; | ||
8 | 9 | ||
9 | import './index.scss'; | 10 | import './index.scss'; |
10 | 11 | ||
12 | const log = getLogger('index'); | ||
13 | |||
11 | const initialValue = `class Family { | 14 | const initialValue = `class Family { |
12 | contains Person[] members | 15 | contains Person[] members |
13 | } | 16 | } |
@@ -66,4 +69,10 @@ const app = ( | |||
66 | </RootStoreProvider> | 69 | </RootStoreProvider> |
67 | ); | 70 | ); |
68 | 71 | ||
69 | render(app, document.getElementById('app')); | 72 | const rootElement = document.getElementById('app'); |
73 | if (rootElement === null) { | ||
74 | log.error('Root element not found'); | ||
75 | } else { | ||
76 | const root = createRoot(rootElement); | ||
77 | root.render(app); | ||
78 | } | ||
diff --git a/subprojects/frontend/src/language/folding.ts b/subprojects/frontend/src/language/folding.ts index 5d51f796..2560c183 100644 --- a/subprojects/frontend/src/language/folding.ts +++ b/subprojects/frontend/src/language/folding.ts | |||
@@ -52,7 +52,7 @@ export function foldDeclaration(node: SyntaxNode, state: EditorState): FoldRange | |||
52 | if (open === null || close === null) { | 52 | if (open === null || close === null) { |
53 | return null; | 53 | return null; |
54 | } | 54 | } |
55 | const { cursor } = open; | 55 | const cursor = open.cursor(); |
56 | const lineEnd = state.doc.lineAt(open.from).to; | 56 | const lineEnd = state.doc.lineAt(open.from).to; |
57 | let foldFrom = open.to; | 57 | let foldFrom = open.to; |
58 | while (cursor.next() && cursor.from < lineEnd) { | 58 | while (cursor.next() && cursor.from < lineEnd) { |
@@ -84,7 +84,7 @@ function foldWithSibling(node: SyntaxNode): FoldRange | null { | |||
84 | if (firstChild === null) { | 84 | if (firstChild === null) { |
85 | return null; | 85 | return null; |
86 | } | 86 | } |
87 | const { cursor } = firstChild; | 87 | const cursor = firstChild.cursor(); |
88 | let nSiblings = 0; | 88 | let nSiblings = 0; |
89 | while (cursor.nextSibling()) { | 89 | while (cursor.nextSibling()) { |
90 | if (cursor.type === node.type) { | 90 | if (cursor.type === node.type) { |
diff --git a/subprojects/frontend/src/language/indentation.ts b/subprojects/frontend/src/language/indentation.ts index 6d36ed3b..55dcd7f1 100644 --- a/subprojects/frontend/src/language/indentation.ts +++ b/subprojects/frontend/src/language/indentation.ts | |||
@@ -23,7 +23,7 @@ function findAlignmentAfterOpening(context: TreeIndentContext): number | null { | |||
23 | const lineEnd = simulatedBreak == null || simulatedBreak <= openingLine.from | 23 | const lineEnd = simulatedBreak == null || simulatedBreak <= openingLine.from |
24 | ? openingLine.to | 24 | ? openingLine.to |
25 | : Math.min(openingLine.to, simulatedBreak); | 25 | : Math.min(openingLine.to, simulatedBreak); |
26 | const { cursor } = openingToken; | 26 | const cursor = openingToken.cursor(); |
27 | while (cursor.next() && cursor.from < lineEnd) { | 27 | while (cursor.next() && cursor.from < lineEnd) { |
28 | if (!cursor.type.isSkipped) { | 28 | if (!cursor.type.isSkipped) { |
29 | return cursor.from; | 29 | return cursor.from; |
diff --git a/subprojects/frontend/src/language/problemLanguageSupport.ts b/subprojects/frontend/src/language/problemLanguageSupport.ts index b858ba91..b6e2f14e 100644 --- a/subprojects/frontend/src/language/problemLanguageSupport.ts +++ b/subprojects/frontend/src/language/problemLanguageSupport.ts | |||
@@ -1,4 +1,3 @@ | |||
1 | import { styleTags, tags as t } from '@codemirror/highlight'; | ||
2 | import { | 1 | import { |
3 | foldInside, | 2 | foldInside, |
4 | foldNodeProp, | 3 | foldNodeProp, |
@@ -7,6 +6,7 @@ import { | |||
7 | LanguageSupport, | 6 | LanguageSupport, |
8 | LRLanguage, | 7 | LRLanguage, |
9 | } from '@codemirror/language'; | 8 | } from '@codemirror/language'; |
9 | import { styleTags, tags as t } from '@lezer/highlight'; | ||
10 | import { LRParser } from '@lezer/lr'; | 10 | import { LRParser } from '@lezer/lr'; |
11 | 11 | ||
12 | import { parser } from '../../build/generated/sources/lezer/problem'; | 12 | import { parser } from '../../build/generated/sources/lezer/problem'; |
diff --git a/subprojects/frontend/src/theme/ThemeProvider.tsx b/subprojects/frontend/src/theme/ThemeProvider.tsx index f5b50be1..c6194c69 100644 --- a/subprojects/frontend/src/theme/ThemeProvider.tsx +++ b/subprojects/frontend/src/theme/ThemeProvider.tsx | |||
@@ -1,10 +1,10 @@ | |||
1 | import { observer } from 'mobx-react-lite'; | 1 | import { observer } from 'mobx-react-lite'; |
2 | import { ThemeProvider as MaterialUiThemeProvider } from '@mui/material/styles'; | 2 | import { ThemeProvider as MaterialUiThemeProvider } from '@mui/material/styles'; |
3 | import React from 'react'; | 3 | import React, { type ReactNode } from 'react'; |
4 | 4 | ||
5 | import { useRootStore } from '../RootStore'; | 5 | import { useRootStore } from '../RootStore'; |
6 | 6 | ||
7 | export const ThemeProvider: React.FC = observer(({ children }) => { | 7 | export const ThemeProvider: React.FC<{ children: ReactNode }> = observer(({ children }) => { |
8 | const { themeStore } = useRootStore(); | 8 | const { themeStore } = useRootStore(); |
9 | 9 | ||
10 | return ( | 10 | return ( |
diff --git a/subprojects/frontend/src/xtext/ContentAssistService.ts b/subprojects/frontend/src/xtext/ContentAssistService.ts index 8b872e06..cf0fb49f 100644 --- a/subprojects/frontend/src/xtext/ContentAssistService.ts +++ b/subprojects/frontend/src/xtext/ContentAssistService.ts | |||
@@ -169,7 +169,7 @@ export class ContentAssistService { | |||
169 | this.lastCompletion = { | 169 | this.lastCompletion = { |
170 | ...range, | 170 | ...range, |
171 | options, | 171 | options, |
172 | span: computeSpan(prefix, entries.length), | 172 | validFor: computeSpan(prefix, entries.length), |
173 | }; | 173 | }; |
174 | return this.lastCompletion; | 174 | return this.lastCompletion; |
175 | } | 175 | } |
@@ -181,15 +181,15 @@ export class ContentAssistService { | |||
181 | return false; | 181 | return false; |
182 | } | 182 | } |
183 | const { from, to, text } = token; | 183 | const { from, to, text } = token; |
184 | const { from: lastFrom, to: lastTo, span } = this.lastCompletion; | 184 | const { from: lastFrom, to: lastTo, validFor } = this.lastCompletion; |
185 | if (!lastTo) { | 185 | if (!lastTo) { |
186 | return true; | 186 | return true; |
187 | } | 187 | } |
188 | const [transformedFrom, transformedTo] = this.mapRangeInclusive(lastFrom, lastTo); | 188 | const [transformedFrom, transformedTo] = this.mapRangeInclusive(lastFrom, lastTo); |
189 | return from >= transformedFrom | 189 | return from >= transformedFrom |
190 | && to <= transformedTo | 190 | && to <= transformedTo |
191 | && typeof span !== 'undefined' | 191 | && validFor instanceof RegExp |
192 | && span.exec(text) !== null; | 192 | && validFor.exec(text) !== null; |
193 | } | 193 | } |
194 | 194 | ||
195 | private shouldInvalidateCachedCompletion(transaction: Transaction): boolean { | 195 | private shouldInvalidateCachedCompletion(transaction: Transaction): boolean { |
diff --git a/subprojects/frontend/src/xtext/xtextMessages.ts b/subprojects/frontend/src/xtext/xtextMessages.ts index c4305fcf..4bf49c17 100644 --- a/subprojects/frontend/src/xtext/xtextMessages.ts +++ b/subprojects/frontend/src/xtext/xtextMessages.ts | |||
@@ -1,14 +1,14 @@ | |||
1 | import { z } from 'zod'; | 1 | import { z } from 'zod'; |
2 | 2 | ||
3 | export const xtextWebRequest = z.object({ | 3 | export const xtextWebRequest = z.object({ |
4 | id: z.string().nonempty(), | 4 | id: z.string().min(1), |
5 | request: z.unknown(), | 5 | request: z.unknown(), |
6 | }); | 6 | }); |
7 | 7 | ||
8 | export type XtextWebRequest = z.infer<typeof xtextWebRequest>; | 8 | export type XtextWebRequest = z.infer<typeof xtextWebRequest>; |
9 | 9 | ||
10 | export const xtextWebOkResponse = z.object({ | 10 | export const xtextWebOkResponse = z.object({ |
11 | id: z.string().nonempty(), | 11 | id: z.string().min(1), |
12 | response: z.unknown(), | 12 | response: z.unknown(), |
13 | }); | 13 | }); |
14 | 14 | ||
@@ -19,7 +19,7 @@ export const xtextWebErrorKind = z.enum(['request', 'server']); | |||
19 | export type XtextWebErrorKind = z.infer<typeof xtextWebErrorKind>; | 19 | export type XtextWebErrorKind = z.infer<typeof xtextWebErrorKind>; |
20 | 20 | ||
21 | export const xtextWebErrorResponse = z.object({ | 21 | export const xtextWebErrorResponse = z.object({ |
22 | id: z.string().nonempty(), | 22 | id: z.string().min(1), |
23 | error: xtextWebErrorKind, | 23 | error: xtextWebErrorKind, |
24 | message: z.string(), | 24 | message: z.string(), |
25 | }); | 25 | }); |
@@ -31,8 +31,8 @@ export const xtextWebPushService = z.enum(['highlight', 'validate']); | |||
31 | export type XtextWebPushService = z.infer<typeof xtextWebPushService>; | 31 | export type XtextWebPushService = z.infer<typeof xtextWebPushService>; |
32 | 32 | ||
33 | export const xtextWebPushMessage = z.object({ | 33 | export const xtextWebPushMessage = z.object({ |
34 | resource: z.string().nonempty(), | 34 | resource: z.string().min(1), |
35 | stateId: z.string().nonempty(), | 35 | stateId: z.string().min(1), |
36 | service: xtextWebPushService, | 36 | service: xtextWebPushService, |
37 | push: z.unknown(), | 37 | push: z.unknown(), |
38 | }); | 38 | }); |
diff --git a/subprojects/frontend/src/xtext/xtextServiceResults.ts b/subprojects/frontend/src/xtext/xtextServiceResults.ts index f79b059c..8b0dbbfb 100644 --- a/subprojects/frontend/src/xtext/xtextServiceResults.ts +++ b/subprojects/frontend/src/xtext/xtextServiceResults.ts | |||
@@ -1,13 +1,13 @@ | |||
1 | import { z } from 'zod'; | 1 | import { z } from 'zod'; |
2 | 2 | ||
3 | export const pongResult = z.object({ | 3 | export const pongResult = z.object({ |
4 | pong: z.string().nonempty(), | 4 | pong: z.string().min(1), |
5 | }); | 5 | }); |
6 | 6 | ||
7 | export type PongResult = z.infer<typeof pongResult>; | 7 | export type PongResult = z.infer<typeof pongResult>; |
8 | 8 | ||
9 | export const documentStateResult = z.object({ | 9 | export const documentStateResult = z.object({ |
10 | stateId: z.string().nonempty(), | 10 | stateId: z.string().min(1), |
11 | }); | 11 | }); |
12 | 12 | ||
13 | export type DocumentStateResult = z.infer<typeof documentStateResult>; | 13 | export type DocumentStateResult = z.infer<typeof documentStateResult>; |
@@ -32,7 +32,7 @@ export const severity = z.enum(['error', 'warning', 'info', 'ignore']); | |||
32 | export type Severity = z.infer<typeof severity>; | 32 | export type Severity = z.infer<typeof severity>; |
33 | 33 | ||
34 | export const issue = z.object({ | 34 | export const issue = z.object({ |
35 | description: z.string().nonempty(), | 35 | description: z.string().min(1), |
36 | severity, | 36 | severity, |
37 | line: z.number().int(), | 37 | line: z.number().int(), |
38 | column: z.number().int().nonnegative(), | 38 | column: z.number().int().nonnegative(), |
@@ -65,14 +65,14 @@ export type TextRegion = z.infer<typeof textRegion>; | |||
65 | 65 | ||
66 | export const contentAssistEntry = z.object({ | 66 | export const contentAssistEntry = z.object({ |
67 | prefix: z.string(), | 67 | prefix: z.string(), |
68 | proposal: z.string().nonempty(), | 68 | proposal: z.string().min(1), |
69 | label: z.string().optional(), | 69 | label: z.string().optional(), |
70 | description: z.string().nonempty().optional(), | 70 | description: z.string().min(1).optional(), |
71 | documentation: z.string().nonempty().optional(), | 71 | documentation: z.string().min(1).optional(), |
72 | escapePosition: z.number().int().nonnegative().optional(), | 72 | escapePosition: z.number().int().nonnegative().optional(), |
73 | textReplacements: replaceRegion.array(), | 73 | textReplacements: replaceRegion.array(), |
74 | editPositions: textRegion.array(), | 74 | editPositions: textRegion.array(), |
75 | kind: z.string().nonempty(), | 75 | kind: z.string().min(1), |
76 | }); | 76 | }); |
77 | 77 | ||
78 | export type ContentAssistEntry = z.infer<typeof contentAssistEntry>; | 78 | export type ContentAssistEntry = z.infer<typeof contentAssistEntry>; |
@@ -86,7 +86,7 @@ export type ContentAssistResult = z.infer<typeof contentAssistResult>; | |||
86 | export const highlightingRegion = z.object({ | 86 | export const highlightingRegion = z.object({ |
87 | offset: z.number().int().nonnegative(), | 87 | offset: z.number().int().nonnegative(), |
88 | length: z.number().int().nonnegative(), | 88 | length: z.number().int().nonnegative(), |
89 | styleClasses: z.string().nonempty().array(), | 89 | styleClasses: z.string().min(1).array(), |
90 | }); | 90 | }); |
91 | 91 | ||
92 | export type HighlightingRegion = z.infer<typeof highlightingRegion>; | 92 | export type HighlightingRegion = z.infer<typeof highlightingRegion>; |