monaco-languageclient-examples 2025.6.3 → 2025.8.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/CHANGELOG.md +3 -2
- package/dist/appPlayground/common.d.ts +2 -2
- package/dist/appPlayground/common.d.ts.map +1 -1
- package/dist/appPlayground/common.js +3 -2
- package/dist/appPlayground/common.js.map +1 -1
- package/dist/appPlayground/config.d.ts +2 -4
- package/dist/appPlayground/config.d.ts.map +1 -1
- package/dist/appPlayground/config.js +63 -65
- package/dist/appPlayground/config.js.map +1 -1
- package/dist/appPlayground/launcher.js +1 -1
- package/dist/appPlayground/launcher.js.map +1 -1
- package/dist/appPlayground/main.d.ts.map +1 -1
- package/dist/appPlayground/main.js +4 -5
- package/dist/appPlayground/main.js.map +1 -1
- package/dist/appPlayground/reactLauncher.js +1 -1
- package/dist/appPlayground/reactLauncher.js.map +1 -1
- package/dist/appPlayground/reactMain.d.ts.map +1 -1
- package/dist/appPlayground/reactMain.js +3 -2
- package/dist/appPlayground/reactMain.js.map +1 -1
- package/dist/bare/client.d.ts.map +1 -1
- package/dist/bare/client.js +15 -12
- package/dist/bare/client.js.map +1 -1
- package/dist/browser/main.d.ts.map +1 -1
- package/dist/browser/main.js +27 -28
- package/dist/browser/main.js.map +1 -1
- package/dist/clangd/client/config.d.ts +3 -10
- package/dist/clangd/client/config.d.ts.map +1 -1
- package/dist/clangd/client/config.js +85 -85
- package/dist/clangd/client/config.js.map +1 -1
- package/dist/clangd/client/main.d.ts.map +1 -1
- package/dist/clangd/client/main.js +9 -12
- package/dist/clangd/client/main.js.map +1 -1
- package/dist/clangd/worker/clangd-server.js.map +1 -1
- package/dist/common/client/utils.d.ts +1 -8
- package/dist/common/client/utils.d.ts.map +1 -1
- package/dist/common/client/utils.js +3 -0
- package/dist/common/client/utils.js.map +1 -1
- package/dist/debugger/client/debugger.d.ts +1 -1
- package/dist/debugger/client/debugger.d.ts.map +1 -1
- package/dist/eclipse.jdt.ls/client/main.d.ts +1 -1
- package/dist/eclipse.jdt.ls/client/main.d.ts.map +1 -1
- package/dist/eclipse.jdt.ls/client/main.js +74 -4
- package/dist/eclipse.jdt.ls/client/main.js.map +1 -1
- package/dist/eclipse.jdt.ls/config.d.ts +5 -2
- package/dist/eclipse.jdt.ls/config.d.ts.map +1 -1
- package/dist/eclipse.jdt.ls/config.js +1 -2
- package/dist/eclipse.jdt.ls/config.js.map +1 -1
- package/dist/groovy/client/main.d.ts +1 -1
- package/dist/groovy/client/main.d.ts.map +1 -1
- package/dist/groovy/client/main.js +63 -4
- package/dist/groovy/client/main.js.map +1 -1
- package/dist/groovy/config.d.ts +5 -2
- package/dist/groovy/config.d.ts.map +1 -1
- package/dist/groovy/config.js +1 -2
- package/dist/groovy/config.js.map +1 -1
- package/dist/json/client/wrapperWs.d.ts +5 -0
- package/dist/json/client/wrapperWs.d.ts.map +1 -0
- package/dist/json/client/wrapperWs.js +87 -0
- package/dist/json/client/wrapperWs.js.map +1 -0
- package/dist/json/server/main.js.map +1 -1
- package/dist/langium/langium-dsl/config/classicConfig.d.ts +2 -2
- package/dist/langium/langium-dsl/config/classicConfig.d.ts.map +1 -1
- package/dist/langium/langium-dsl/config/classicConfig.js +45 -53
- package/dist/langium/langium-dsl/config/classicConfig.js.map +1 -1
- package/dist/langium/langium-dsl/config/extendedConfig.d.ts +2 -2
- package/dist/langium/langium-dsl/config/extendedConfig.d.ts.map +1 -1
- package/dist/langium/langium-dsl/config/extendedConfig.js +40 -40
- package/dist/langium/langium-dsl/config/extendedConfig.js.map +1 -1
- package/dist/langium/langium-dsl/wrapperLangium.d.ts.map +1 -1
- package/dist/langium/langium-dsl/wrapperLangium.js +16 -23
- package/dist/langium/langium-dsl/wrapperLangium.js.map +1 -1
- package/dist/langium/statemachine/config/wrapperStatemachineConfig.d.ts +4 -4
- package/dist/langium/statemachine/config/wrapperStatemachineConfig.d.ts.map +1 -1
- package/dist/langium/statemachine/config/wrapperStatemachineConfig.js +41 -40
- package/dist/langium/statemachine/config/wrapperStatemachineConfig.js.map +1 -1
- package/dist/langium/statemachine/launcher.js +1 -1
- package/dist/langium/statemachine/launcher.js.map +1 -1
- package/dist/langium/statemachine/ls/generated/ast.d.ts +127 -22
- package/dist/langium/statemachine/ls/generated/ast.d.ts.map +1 -1
- package/dist/langium/statemachine/ls/generated/ast.js +112 -97
- package/dist/langium/statemachine/ls/generated/ast.js.map +1 -1
- package/dist/langium/statemachine/ls/generated/grammar.d.ts +2 -2
- package/dist/langium/statemachine/ls/generated/grammar.d.ts.map +1 -1
- package/dist/langium/statemachine/ls/generated/grammar.js +43 -41
- package/dist/langium/statemachine/ls/generated/grammar.js.map +1 -1
- package/dist/langium/statemachine/ls/generated/module.d.ts +3 -3
- package/dist/langium/statemachine/ls/generated/module.d.ts.map +1 -1
- package/dist/langium/statemachine/ls/generated/module.js +6 -6
- package/dist/langium/statemachine/ls/generated/module.js.map +1 -1
- package/dist/langium/statemachine/ls/statemachine-module.js +2 -2
- package/dist/langium/statemachine/ls/statemachine-module.js.map +1 -1
- package/dist/langium/statemachine/main-react.js +3 -2
- package/dist/langium/statemachine/main-react.js.map +1 -1
- package/dist/langium/statemachine/main.d.ts.map +1 -1
- package/dist/langium/statemachine/main.js +27 -38
- package/dist/langium/statemachine/main.js.map +1 -1
- package/dist/multi/config.d.ts +1 -1
- package/dist/multi/config.d.ts.map +1 -1
- package/dist/multi/config.js +1 -0
- package/dist/multi/config.js.map +1 -1
- package/dist/multi/twoLanguageClients.d.ts.map +1 -1
- package/dist/multi/twoLanguageClients.js +49 -45
- package/dist/multi/twoLanguageClients.js.map +1 -1
- package/dist/node.d.ts +3 -0
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +3 -3
- package/dist/node.js.map +1 -1
- package/dist/python/client/config.d.ts +3 -7
- package/dist/python/client/config.d.ts.map +1 -1
- package/dist/python/client/config.js +97 -93
- package/dist/python/client/config.js.map +1 -1
- package/dist/python/client/main.d.ts.map +1 -1
- package/dist/python/client/main.js +10 -16
- package/dist/python/client/main.js.map +1 -1
- package/dist/python/client/reactPython.d.ts.map +1 -1
- package/dist/python/client/reactPython.js +9 -8
- package/dist/python/client/reactPython.js.map +1 -1
- package/dist/ts/wrapperTs.d.ts.map +1 -1
- package/dist/ts/wrapperTs.js +45 -50
- package/dist/ts/wrapperTs.js.map +1 -1
- package/json.html +1 -1
- package/package.json +45 -44
- package/src/appPlayground/common.ts +3 -3
- package/src/appPlayground/config.ts +65 -69
- package/src/appPlayground/launcher.ts +1 -2
- package/src/appPlayground/main.ts +5 -8
- package/src/appPlayground/reactLauncher.ts +1 -2
- package/src/appPlayground/reactMain.tsx +4 -4
- package/src/bare/client.ts +16 -15
- package/src/browser/main.ts +27 -29
- package/src/clangd/client/config.ts +87 -97
- package/src/clangd/client/main.ts +10 -14
- package/src/clangd/worker/clangd-server.ts +2 -2
- package/src/common/client/utils.ts +2 -7
- package/src/debugger/client/debugger.ts +1 -1
- package/src/eclipse.jdt.ls/client/main.ts +78 -4
- package/src/eclipse.jdt.ls/config.ts +2 -6
- package/src/groovy/client/main.ts +65 -4
- package/src/groovy/config.ts +2 -6
- package/src/json/client/wrapperWs.ts +90 -0
- package/src/json/server/main.ts +1 -1
- package/src/langium/langium-dsl/config/classicConfig.ts +48 -64
- package/src/langium/langium-dsl/config/extendedConfig.ts +42 -49
- package/src/langium/langium-dsl/wrapperLangium.ts +15 -25
- package/src/langium/statemachine/config/wrapperStatemachineConfig.ts +45 -48
- package/src/langium/statemachine/launcher.ts +1 -1
- package/src/langium/statemachine/ls/generated/ast.ts +131 -111
- package/src/langium/statemachine/ls/generated/grammar.ts +43 -41
- package/src/langium/statemachine/ls/generated/module.ts +6 -6
- package/src/langium/statemachine/ls/statemachine-module.ts +2 -2
- package/src/langium/statemachine/ls/statemachine.langium +20 -5
- package/src/langium/statemachine/main-react.tsx +4 -4
- package/src/langium/statemachine/main.ts +27 -43
- package/src/multi/config.ts +3 -3
- package/src/multi/twoLanguageClients.ts +52 -48
- package/src/node.ts +3 -3
- package/src/python/client/config.ts +99 -101
- package/src/python/client/main.ts +11 -20
- package/src/python/client/reactPython.tsx +10 -11
- package/src/ts/wrapperTs.ts +45 -52
- package/two_langauge_clients.html +1 -0
- package/dist/common/client/extendedClient.d.ts +0 -9
- package/dist/common/client/extendedClient.d.ts.map +0 -1
- package/dist/common/client/extendedClient.js +0 -97
- package/dist/common/client/extendedClient.js.map +0 -1
- package/dist/json/client/client.d.ts +0 -3
- package/dist/json/client/client.d.ts.map +0 -1
- package/dist/json/client/client.js +0 -13
- package/dist/json/client/client.js.map +0 -1
- package/dist/json/client/config.d.ts +0 -3
- package/dist/json/client/config.d.ts.map +0 -1
- package/dist/json/client/config.js +0 -11
- package/dist/json/client/config.js.map +0 -1
- package/src/common/client/extendedClient.ts +0 -111
- package/src/json/client/client.ts +0 -14
- package/src/json/client/config.ts +0 -13
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
|
-
* This file was generated by langium-cli
|
|
2
|
+
* This file was generated by langium-cli 4.0.0.
|
|
3
3
|
* DO NOT EDIT MANUALLY!
|
|
4
4
|
******************************************************************************/
|
|
5
5
|
|
|
6
6
|
/* eslint-disable */
|
|
7
|
-
import
|
|
8
|
-
import { AbstractAstReflection } from 'langium';
|
|
7
|
+
import * as langium from 'langium';
|
|
9
8
|
|
|
10
9
|
export const StatemachineTerminals = {
|
|
11
10
|
WS: /\s+/,
|
|
@@ -30,70 +29,103 @@ export type StatemachineKeywordNames =
|
|
|
30
29
|
|
|
31
30
|
export type StatemachineTokenNames = StatemachineTerminalNames | StatemachineKeywordNames;
|
|
32
31
|
|
|
33
|
-
export interface Command extends AstNode {
|
|
32
|
+
export interface Command extends langium.AstNode {
|
|
34
33
|
readonly $container: Statemachine;
|
|
35
34
|
readonly $type: 'Command';
|
|
36
35
|
name: string;
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
export const Command =
|
|
38
|
+
export const Command = {
|
|
39
|
+
$type: 'Command',
|
|
40
|
+
name: 'name'
|
|
41
|
+
} as const;
|
|
40
42
|
|
|
41
43
|
export function isCommand(item: unknown): item is Command {
|
|
42
|
-
return reflection.isInstance(item, Command);
|
|
44
|
+
return reflection.isInstance(item, Command.$type);
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
/** An event is the trigger for a transition */
|
|
48
|
+
export interface Event extends langium.AstNode {
|
|
46
49
|
readonly $container: Statemachine;
|
|
47
50
|
readonly $type: 'Event';
|
|
48
51
|
name: string;
|
|
49
52
|
}
|
|
50
53
|
|
|
51
|
-
export const Event =
|
|
54
|
+
export const Event = {
|
|
55
|
+
$type: 'Event',
|
|
56
|
+
name: 'name'
|
|
57
|
+
} as const;
|
|
52
58
|
|
|
53
59
|
export function isEvent(item: unknown): item is Event {
|
|
54
|
-
return reflection.isInstance(item, Event);
|
|
60
|
+
return reflection.isInstance(item, Event.$type);
|
|
55
61
|
}
|
|
56
62
|
|
|
57
|
-
|
|
63
|
+
/** A description of the status of a system */
|
|
64
|
+
export interface State extends langium.AstNode {
|
|
58
65
|
readonly $container: Statemachine;
|
|
59
66
|
readonly $type: 'State';
|
|
60
|
-
actions: Array<Reference<Command>>;
|
|
67
|
+
actions: Array<langium.Reference<Command>>;
|
|
61
68
|
name: string;
|
|
69
|
+
/** The transitions to other states that can take place from the current one */
|
|
62
70
|
transitions: Array<Transition>;
|
|
63
71
|
}
|
|
64
72
|
|
|
65
|
-
export const State =
|
|
73
|
+
export const State = {
|
|
74
|
+
$type: 'State',
|
|
75
|
+
actions: 'actions',
|
|
76
|
+
name: 'name',
|
|
77
|
+
transitions: 'transitions'
|
|
78
|
+
} as const;
|
|
66
79
|
|
|
67
80
|
export function isState(item: unknown): item is State {
|
|
68
|
-
return reflection.isInstance(item, State);
|
|
81
|
+
return reflection.isInstance(item, State.$type);
|
|
69
82
|
}
|
|
70
83
|
|
|
71
|
-
|
|
84
|
+
/** A textual representation of a state machine */
|
|
85
|
+
export interface Statemachine extends langium.AstNode {
|
|
72
86
|
readonly $type: 'Statemachine';
|
|
73
87
|
commands: Array<Command>;
|
|
88
|
+
/** The list of recognized event names */
|
|
74
89
|
events: Array<Event>;
|
|
75
|
-
|
|
90
|
+
/** The starting state for the machine */
|
|
91
|
+
init: langium.Reference<State>;
|
|
92
|
+
/** The name of the machine */
|
|
76
93
|
name: string;
|
|
94
|
+
/** Definitions of available states */
|
|
77
95
|
states: Array<State>;
|
|
78
96
|
}
|
|
79
97
|
|
|
80
|
-
export const Statemachine =
|
|
98
|
+
export const Statemachine = {
|
|
99
|
+
$type: 'Statemachine',
|
|
100
|
+
commands: 'commands',
|
|
101
|
+
events: 'events',
|
|
102
|
+
init: 'init',
|
|
103
|
+
name: 'name',
|
|
104
|
+
states: 'states'
|
|
105
|
+
} as const;
|
|
81
106
|
|
|
82
107
|
export function isStatemachine(item: unknown): item is Statemachine {
|
|
83
|
-
return reflection.isInstance(item, Statemachine);
|
|
108
|
+
return reflection.isInstance(item, Statemachine.$type);
|
|
84
109
|
}
|
|
85
110
|
|
|
86
|
-
|
|
111
|
+
/** A change from one state to another */
|
|
112
|
+
export interface Transition extends langium.AstNode {
|
|
87
113
|
readonly $container: State;
|
|
88
114
|
readonly $type: 'Transition';
|
|
89
|
-
event
|
|
90
|
-
|
|
115
|
+
/** The event triggering the transition */
|
|
116
|
+
event: langium.Reference<Event>;
|
|
117
|
+
/** The target state */
|
|
118
|
+
state: langium.Reference<State>;
|
|
91
119
|
}
|
|
92
120
|
|
|
93
|
-
export const Transition =
|
|
121
|
+
export const Transition = {
|
|
122
|
+
$type: 'Transition',
|
|
123
|
+
event: 'event',
|
|
124
|
+
state: 'state'
|
|
125
|
+
} as const;
|
|
94
126
|
|
|
95
127
|
export function isTransition(item: unknown): item is Transition {
|
|
96
|
-
return reflection.isInstance(item, Transition);
|
|
128
|
+
return reflection.isInstance(item, Transition.$type);
|
|
97
129
|
}
|
|
98
130
|
|
|
99
131
|
export type StatemachineAstType = {
|
|
@@ -104,96 +136,84 @@ export type StatemachineAstType = {
|
|
|
104
136
|
Transition: Transition
|
|
105
137
|
}
|
|
106
138
|
|
|
107
|
-
export class StatemachineAstReflection extends AbstractAstReflection {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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
|
-
properties: [
|
|
184
|
-
{ name: 'event' },
|
|
185
|
-
{ name: 'state' }
|
|
186
|
-
]
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
default: {
|
|
190
|
-
return {
|
|
191
|
-
name: type,
|
|
192
|
-
properties: []
|
|
193
|
-
};
|
|
194
|
-
}
|
|
139
|
+
export class StatemachineAstReflection extends langium.AbstractAstReflection {
|
|
140
|
+
override readonly types = {
|
|
141
|
+
Command: {
|
|
142
|
+
name: Command.$type,
|
|
143
|
+
properties: {
|
|
144
|
+
name: {
|
|
145
|
+
name: Command.name
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
superTypes: []
|
|
149
|
+
},
|
|
150
|
+
Event: {
|
|
151
|
+
name: Event.$type,
|
|
152
|
+
properties: {
|
|
153
|
+
name: {
|
|
154
|
+
name: Event.name
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
superTypes: []
|
|
158
|
+
},
|
|
159
|
+
State: {
|
|
160
|
+
name: State.$type,
|
|
161
|
+
properties: {
|
|
162
|
+
actions: {
|
|
163
|
+
name: State.actions,
|
|
164
|
+
defaultValue: [],
|
|
165
|
+
referenceType: Command.$type
|
|
166
|
+
},
|
|
167
|
+
name: {
|
|
168
|
+
name: State.name
|
|
169
|
+
},
|
|
170
|
+
transitions: {
|
|
171
|
+
name: State.transitions,
|
|
172
|
+
defaultValue: []
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
superTypes: []
|
|
176
|
+
},
|
|
177
|
+
Statemachine: {
|
|
178
|
+
name: Statemachine.$type,
|
|
179
|
+
properties: {
|
|
180
|
+
commands: {
|
|
181
|
+
name: Statemachine.commands,
|
|
182
|
+
defaultValue: []
|
|
183
|
+
},
|
|
184
|
+
events: {
|
|
185
|
+
name: Statemachine.events,
|
|
186
|
+
defaultValue: []
|
|
187
|
+
},
|
|
188
|
+
init: {
|
|
189
|
+
name: Statemachine.init,
|
|
190
|
+
referenceType: State.$type
|
|
191
|
+
},
|
|
192
|
+
name: {
|
|
193
|
+
name: Statemachine.name
|
|
194
|
+
},
|
|
195
|
+
states: {
|
|
196
|
+
name: Statemachine.states,
|
|
197
|
+
defaultValue: []
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
superTypes: []
|
|
201
|
+
},
|
|
202
|
+
Transition: {
|
|
203
|
+
name: Transition.$type,
|
|
204
|
+
properties: {
|
|
205
|
+
event: {
|
|
206
|
+
name: Transition.event,
|
|
207
|
+
referenceType: Event.$type
|
|
208
|
+
},
|
|
209
|
+
state: {
|
|
210
|
+
name: Transition.state,
|
|
211
|
+
referenceType: State.$type
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
superTypes: []
|
|
195
215
|
}
|
|
196
|
-
}
|
|
216
|
+
} as const satisfies langium.AstMetaData
|
|
197
217
|
}
|
|
198
218
|
|
|
199
219
|
export const reflection = new StatemachineAstReflection();
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
|
-
* This file was generated by langium-cli
|
|
2
|
+
* This file was generated by langium-cli 4.0.0.
|
|
3
3
|
* DO NOT EDIT MANUALLY!
|
|
4
4
|
******************************************************************************/
|
|
5
5
|
|
|
6
6
|
import type { Grammar } from 'langium';
|
|
7
7
|
import { loadGrammarFromJson } from 'langium';
|
|
8
8
|
|
|
9
|
-
let
|
|
10
|
-
export const
|
|
9
|
+
let loadedStatemachineModelGrammar: Grammar | undefined;
|
|
10
|
+
export const StatemachineModelGrammar = (): Grammar => loadedStatemachineModelGrammar ?? (loadedStatemachineModelGrammar = loadGrammarFromJson(`{
|
|
11
11
|
"$type": "Grammar",
|
|
12
12
|
"isDeclared": true,
|
|
13
|
-
"name": "
|
|
13
|
+
"name": "StatemachineModel",
|
|
14
14
|
"rules": [
|
|
15
15
|
{
|
|
16
16
|
"$type": "ParserRule",
|
|
17
|
-
"name": "Statemachine",
|
|
18
17
|
"entry": true,
|
|
18
|
+
"name": "Statemachine",
|
|
19
19
|
"definition": {
|
|
20
20
|
"$type": "Group",
|
|
21
21
|
"elements": [
|
|
@@ -33,7 +33,8 @@ export const StatemachineGrammar = (): Grammar => loadedStatemachineGrammar ?? (
|
|
|
33
33
|
"$ref": "#/rules@6"
|
|
34
34
|
},
|
|
35
35
|
"arguments": []
|
|
36
|
-
}
|
|
36
|
+
},
|
|
37
|
+
"$comment": "/** The name of the machine */"
|
|
37
38
|
},
|
|
38
39
|
{
|
|
39
40
|
"$type": "Group",
|
|
@@ -53,7 +54,8 @@ export const StatemachineGrammar = (): Grammar => loadedStatemachineGrammar ?? (
|
|
|
53
54
|
},
|
|
54
55
|
"arguments": []
|
|
55
56
|
},
|
|
56
|
-
"cardinality": "+"
|
|
57
|
+
"cardinality": "+",
|
|
58
|
+
"$comment": "/** The list of recognized event names */"
|
|
57
59
|
}
|
|
58
60
|
],
|
|
59
61
|
"cardinality": "?"
|
|
@@ -94,8 +96,10 @@ export const StatemachineGrammar = (): Grammar => loadedStatemachineGrammar ?? (
|
|
|
94
96
|
"type": {
|
|
95
97
|
"$ref": "#/rules@3"
|
|
96
98
|
},
|
|
97
|
-
"deprecatedSyntax": false
|
|
98
|
-
|
|
99
|
+
"deprecatedSyntax": false,
|
|
100
|
+
"isMulti": false
|
|
101
|
+
},
|
|
102
|
+
"$comment": "/** The starting state for the machine */"
|
|
99
103
|
},
|
|
100
104
|
{
|
|
101
105
|
"$type": "Assignment",
|
|
@@ -108,15 +112,14 @@ export const StatemachineGrammar = (): Grammar => loadedStatemachineGrammar ?? (
|
|
|
108
112
|
},
|
|
109
113
|
"arguments": []
|
|
110
114
|
},
|
|
111
|
-
"cardinality": "*"
|
|
115
|
+
"cardinality": "*",
|
|
116
|
+
"$comment": "/** Definitions of available states */"
|
|
112
117
|
}
|
|
113
118
|
]
|
|
114
119
|
},
|
|
115
|
-
"definesHiddenTokens": false,
|
|
116
120
|
"fragment": false,
|
|
117
|
-
"hiddenTokens": [],
|
|
118
121
|
"parameters": [],
|
|
119
|
-
"
|
|
122
|
+
"$comment": "/** A textual representation of a state machine */"
|
|
120
123
|
},
|
|
121
124
|
{
|
|
122
125
|
"$type": "ParserRule",
|
|
@@ -133,12 +136,10 @@ export const StatemachineGrammar = (): Grammar => loadedStatemachineGrammar ?? (
|
|
|
133
136
|
"arguments": []
|
|
134
137
|
}
|
|
135
138
|
},
|
|
136
|
-
"definesHiddenTokens": false,
|
|
137
139
|
"entry": false,
|
|
138
140
|
"fragment": false,
|
|
139
|
-
"hiddenTokens": [],
|
|
140
141
|
"parameters": [],
|
|
141
|
-
"
|
|
142
|
+
"$comment": "/** An event is the trigger for a transition */"
|
|
142
143
|
},
|
|
143
144
|
{
|
|
144
145
|
"$type": "ParserRule",
|
|
@@ -155,12 +156,9 @@ export const StatemachineGrammar = (): Grammar => loadedStatemachineGrammar ?? (
|
|
|
155
156
|
"arguments": []
|
|
156
157
|
}
|
|
157
158
|
},
|
|
158
|
-
"definesHiddenTokens": false,
|
|
159
159
|
"entry": false,
|
|
160
160
|
"fragment": false,
|
|
161
|
-
"
|
|
162
|
-
"parameters": [],
|
|
163
|
-
"wildcard": false
|
|
161
|
+
"parameters": []
|
|
164
162
|
},
|
|
165
163
|
{
|
|
166
164
|
"$type": "ParserRule",
|
|
@@ -204,7 +202,8 @@ export const StatemachineGrammar = (): Grammar => loadedStatemachineGrammar ?? (
|
|
|
204
202
|
"type": {
|
|
205
203
|
"$ref": "#/rules@2"
|
|
206
204
|
},
|
|
207
|
-
"deprecatedSyntax": false
|
|
205
|
+
"deprecatedSyntax": false,
|
|
206
|
+
"isMulti": false
|
|
208
207
|
},
|
|
209
208
|
"cardinality": "+"
|
|
210
209
|
},
|
|
@@ -226,7 +225,8 @@ export const StatemachineGrammar = (): Grammar => loadedStatemachineGrammar ?? (
|
|
|
226
225
|
},
|
|
227
226
|
"arguments": []
|
|
228
227
|
},
|
|
229
|
-
"cardinality": "*"
|
|
228
|
+
"cardinality": "*",
|
|
229
|
+
"$comment": "/** The transitions to other states that can take place from the current one */"
|
|
230
230
|
},
|
|
231
231
|
{
|
|
232
232
|
"$type": "Keyword",
|
|
@@ -234,12 +234,10 @@ export const StatemachineGrammar = (): Grammar => loadedStatemachineGrammar ?? (
|
|
|
234
234
|
}
|
|
235
235
|
]
|
|
236
236
|
},
|
|
237
|
-
"definesHiddenTokens": false,
|
|
238
237
|
"entry": false,
|
|
239
238
|
"fragment": false,
|
|
240
|
-
"hiddenTokens": [],
|
|
241
239
|
"parameters": [],
|
|
242
|
-
"
|
|
240
|
+
"$comment": "/** A description of the status of a system */"
|
|
243
241
|
},
|
|
244
242
|
{
|
|
245
243
|
"$type": "ParserRule",
|
|
@@ -256,8 +254,10 @@ export const StatemachineGrammar = (): Grammar => loadedStatemachineGrammar ?? (
|
|
|
256
254
|
"type": {
|
|
257
255
|
"$ref": "#/rules@1"
|
|
258
256
|
},
|
|
259
|
-
"deprecatedSyntax": false
|
|
260
|
-
|
|
257
|
+
"deprecatedSyntax": false,
|
|
258
|
+
"isMulti": false
|
|
259
|
+
},
|
|
260
|
+
"$comment": "/** The event triggering the transition */"
|
|
261
261
|
},
|
|
262
262
|
{
|
|
263
263
|
"$type": "Keyword",
|
|
@@ -272,17 +272,18 @@ export const StatemachineGrammar = (): Grammar => loadedStatemachineGrammar ?? (
|
|
|
272
272
|
"type": {
|
|
273
273
|
"$ref": "#/rules@3"
|
|
274
274
|
},
|
|
275
|
-
"deprecatedSyntax": false
|
|
276
|
-
|
|
275
|
+
"deprecatedSyntax": false,
|
|
276
|
+
"isMulti": false
|
|
277
|
+
},
|
|
278
|
+
"$comment": "/** The target state */"
|
|
277
279
|
}
|
|
278
|
-
]
|
|
280
|
+
],
|
|
281
|
+
"$comment": "/** The event triggering the transition */"
|
|
279
282
|
},
|
|
280
|
-
"definesHiddenTokens": false,
|
|
281
283
|
"entry": false,
|
|
282
284
|
"fragment": false,
|
|
283
|
-
"hiddenTokens": [],
|
|
284
285
|
"parameters": [],
|
|
285
|
-
"
|
|
286
|
+
"$comment": "/** A change from one state to another */"
|
|
286
287
|
},
|
|
287
288
|
{
|
|
288
289
|
"$type": "TerminalRule",
|
|
@@ -290,7 +291,8 @@ export const StatemachineGrammar = (): Grammar => loadedStatemachineGrammar ?? (
|
|
|
290
291
|
"name": "WS",
|
|
291
292
|
"definition": {
|
|
292
293
|
"$type": "RegexToken",
|
|
293
|
-
"regex": "/\\\\s+/"
|
|
294
|
+
"regex": "/\\\\s+/",
|
|
295
|
+
"parenthesized": false
|
|
294
296
|
},
|
|
295
297
|
"fragment": false
|
|
296
298
|
},
|
|
@@ -299,7 +301,8 @@ export const StatemachineGrammar = (): Grammar => loadedStatemachineGrammar ?? (
|
|
|
299
301
|
"name": "ID",
|
|
300
302
|
"definition": {
|
|
301
303
|
"$type": "RegexToken",
|
|
302
|
-
"regex": "/[_a-zA-Z][\\\\w_]*/"
|
|
304
|
+
"regex": "/[_a-zA-Z][\\\\w_]*/",
|
|
305
|
+
"parenthesized": false
|
|
303
306
|
},
|
|
304
307
|
"fragment": false,
|
|
305
308
|
"hidden": false
|
|
@@ -310,7 +313,8 @@ export const StatemachineGrammar = (): Grammar => loadedStatemachineGrammar ?? (
|
|
|
310
313
|
"name": "ML_COMMENT",
|
|
311
314
|
"definition": {
|
|
312
315
|
"$type": "RegexToken",
|
|
313
|
-
"regex": "/\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\//"
|
|
316
|
+
"regex": "/\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\//",
|
|
317
|
+
"parenthesized": false
|
|
314
318
|
},
|
|
315
319
|
"fragment": false
|
|
316
320
|
},
|
|
@@ -320,15 +324,13 @@ export const StatemachineGrammar = (): Grammar => loadedStatemachineGrammar ?? (
|
|
|
320
324
|
"name": "SL_COMMENT",
|
|
321
325
|
"definition": {
|
|
322
326
|
"$type": "RegexToken",
|
|
323
|
-
"regex": "/\\\\/\\\\/[^\\\\n\\\\r]*/"
|
|
327
|
+
"regex": "/\\\\/\\\\/[^\\\\n\\\\r]*/",
|
|
328
|
+
"parenthesized": false
|
|
324
329
|
},
|
|
325
330
|
"fragment": false
|
|
326
331
|
}
|
|
327
332
|
],
|
|
328
|
-
"definesHiddenTokens": false,
|
|
329
|
-
"hiddenTokens": [],
|
|
330
333
|
"imports": [],
|
|
331
334
|
"interfaces": [],
|
|
332
|
-
"types": []
|
|
333
|
-
"usedGrammars": []
|
|
335
|
+
"types": []
|
|
334
336
|
}`));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
|
-
* This file was generated by langium-cli
|
|
2
|
+
* This file was generated by langium-cli 4.0.0.
|
|
3
3
|
* DO NOT EDIT MANUALLY!
|
|
4
4
|
******************************************************************************/
|
|
5
5
|
|
|
6
6
|
import type { LangiumSharedCoreServices, LangiumCoreServices, LangiumGeneratedCoreServices, LangiumGeneratedSharedCoreServices, LanguageMetaData, Module } from 'langium';
|
|
7
7
|
import { StatemachineAstReflection } from './ast.js';
|
|
8
|
-
import {
|
|
8
|
+
import { StatemachineModelGrammar } from './grammar.js';
|
|
9
9
|
|
|
10
|
-
export const
|
|
10
|
+
export const StatemachineModelLanguageMetaData = {
|
|
11
11
|
languageId: 'statemachine',
|
|
12
12
|
fileExtensions: ['.statemachine'],
|
|
13
13
|
caseInsensitive: false,
|
|
@@ -18,8 +18,8 @@ export const StatemachineGeneratedSharedModule: Module<LangiumSharedCoreServices
|
|
|
18
18
|
AstReflection: () => new StatemachineAstReflection()
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
export const
|
|
22
|
-
Grammar: () =>
|
|
23
|
-
LanguageMetaData: () =>
|
|
21
|
+
export const StatemachineModelGeneratedModule: Module<LangiumCoreServices, LangiumGeneratedCoreServices> = {
|
|
22
|
+
Grammar: () => StatemachineModelGrammar(),
|
|
23
|
+
LanguageMetaData: () => StatemachineModelLanguageMetaData,
|
|
24
24
|
parser: {}
|
|
25
25
|
};
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { type Module, inject } from 'langium';
|
|
7
7
|
import type { LangiumServices, LangiumSharedServices, PartialLangiumServices } from 'langium/lsp';
|
|
8
8
|
import { createDefaultModule, createDefaultSharedModule, type DefaultSharedModuleContext } from 'langium/lsp';
|
|
9
|
-
import {
|
|
9
|
+
import { StatemachineModelGeneratedModule, StatemachineGeneratedSharedModule } from './generated/module.js';
|
|
10
10
|
import { StatemachineValidator, registerValidationChecks } from './statemachine-validator.js';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -60,7 +60,7 @@ export function createStatemachineServices(context: DefaultSharedModuleContext):
|
|
|
60
60
|
);
|
|
61
61
|
const statemachine = inject(
|
|
62
62
|
createDefaultModule({ shared }),
|
|
63
|
-
|
|
63
|
+
StatemachineModelGeneratedModule,
|
|
64
64
|
StatemachineModule
|
|
65
65
|
);
|
|
66
66
|
shared.ServiceRegistry.register(statemachine);
|
|
@@ -1,26 +1,41 @@
|
|
|
1
|
-
grammar
|
|
1
|
+
grammar StatemachineModel
|
|
2
2
|
|
|
3
|
+
/** A textual representation of a state machine */
|
|
3
4
|
entry Statemachine:
|
|
4
|
-
'statemachine'
|
|
5
|
-
|
|
5
|
+
'statemachine'
|
|
6
|
+
/** The name of the machine */
|
|
7
|
+
name=ID
|
|
8
|
+
('events'
|
|
9
|
+
/** The list of recognized event names */
|
|
10
|
+
events+=Event+)?
|
|
6
11
|
('commands' commands+=Command+)?
|
|
7
|
-
'initialState'
|
|
12
|
+
'initialState'
|
|
13
|
+
/** The starting state for the machine */
|
|
14
|
+
init=[State]
|
|
15
|
+
/** Definitions of available states */
|
|
8
16
|
states+=State*;
|
|
9
17
|
|
|
18
|
+
/** An event is the trigger for a transition */
|
|
10
19
|
Event:
|
|
11
20
|
name=ID;
|
|
12
21
|
|
|
13
22
|
Command:
|
|
14
23
|
name=ID;
|
|
15
24
|
|
|
25
|
+
/** A description of the status of a system */
|
|
16
26
|
State:
|
|
17
27
|
'state' name=ID
|
|
18
28
|
('actions' '{' actions+=[Command]+ '}')?
|
|
29
|
+
/** The transitions to other states that can take place from the current one */
|
|
19
30
|
transitions+=Transition*
|
|
20
31
|
'end';
|
|
21
32
|
|
|
33
|
+
/** A change from one state to another */
|
|
22
34
|
Transition:
|
|
23
|
-
event
|
|
35
|
+
/** The event triggering the transition */
|
|
36
|
+
event=[Event] '=>'
|
|
37
|
+
/** The target state */
|
|
38
|
+
state=[State];
|
|
24
39
|
|
|
25
40
|
hidden terminal WS: /\s+/;
|
|
26
41
|
terminal ID: /[_a-zA-Z][\w_]*/;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import React, { StrictMode, useEffect, useState } from 'react';
|
|
7
7
|
import ReactDOM from 'react-dom/client';
|
|
8
8
|
import { BrowserMessageReader, BrowserMessageWriter } from 'vscode-languageclient/browser.js';
|
|
9
|
-
import type { TextContents } from 'monaco-
|
|
9
|
+
import type { TextContents } from 'monaco-editor-wrapper';
|
|
10
10
|
import { MonacoEditorReactComp } from '@typefox/monaco-editor-react';
|
|
11
11
|
import { createLangiumGlobalConfig } from './config/wrapperStatemachineConfig.js';
|
|
12
12
|
import { loadStatemachineWorkerRegular } from './main.js';
|
|
@@ -20,8 +20,9 @@ export const runStatemachineReact = async () => {
|
|
|
20
20
|
reader.listen((message) => {
|
|
21
21
|
console.log('Received message from worker:', message);
|
|
22
22
|
});
|
|
23
|
-
const
|
|
23
|
+
const wrapperConfig = createLangiumGlobalConfig({
|
|
24
24
|
languageServerId: 'react',
|
|
25
|
+
useLanguageClient: true,
|
|
25
26
|
codeContent: {
|
|
26
27
|
text,
|
|
27
28
|
uri: '/workspace/example.statemachine'
|
|
@@ -61,8 +62,7 @@ export const runStatemachineReact = async () => {
|
|
|
61
62
|
<div style={{ 'height': height }} >
|
|
62
63
|
<MonacoEditorReactComp
|
|
63
64
|
style={{ 'height': '100%' }}
|
|
64
|
-
|
|
65
|
-
editorAppConfig={appConfig.editorAppConfig}
|
|
65
|
+
wrapperConfig={wrapperConfig}
|
|
66
66
|
onTextChanged={onTextChanged}
|
|
67
67
|
/>
|
|
68
68
|
<b>Debug:</b><br />{testState}
|