@cedarjs/structure 2.2.2-next.0 → 2.2.2-next.31
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 +8 -24
- package/dist/index.d.ts +3 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -23
- package/dist/model/RWCell.d.ts +4 -3
- package/dist/model/RWCell.d.ts.map +1 -1
- package/dist/model/RWCell.js +7 -8
- package/dist/model/RWComponent.d.ts +1 -1
- package/dist/model/RWComponent.d.ts.map +1 -1
- package/dist/model/RWComponent.js +2 -2
- package/dist/model/RWEnvHelper.d.ts +3 -7
- package/dist/model/RWEnvHelper.d.ts.map +1 -1
- package/dist/model/RWEnvHelper.js +33 -114
- package/dist/model/RWFunction.d.ts +1 -1
- package/dist/model/RWFunction.d.ts.map +1 -1
- package/dist/model/RWFunction.js +2 -2
- package/dist/model/RWLayout.d.ts +1 -1
- package/dist/model/RWLayout.d.ts.map +1 -1
- package/dist/model/RWLayout.js +2 -2
- package/dist/model/RWPage.d.ts +1 -1
- package/dist/model/RWPage.d.ts.map +1 -1
- package/dist/model/RWPage.js +2 -2
- package/dist/model/RWProject.d.ts +1 -4
- package/dist/model/RWProject.d.ts.map +1 -1
- package/dist/model/RWProject.js +17 -19
- package/dist/model/RWRoute.d.ts +3 -16
- package/dist/model/RWRoute.d.ts.map +1 -1
- package/dist/model/RWRoute.js +11 -137
- package/dist/model/RWRouter.d.ts +2 -6
- package/dist/model/RWRouter.d.ts.map +1 -1
- package/dist/model/RWRouter.js +10 -62
- package/dist/model/RWSDL.d.ts +2 -2
- package/dist/model/RWSDL.d.ts.map +1 -1
- package/dist/model/RWSDL.js +4 -4
- package/dist/model/RWSDLField.d.ts +3 -7
- package/dist/model/RWSDLField.d.ts.map +1 -1
- package/dist/model/RWSDLField.js +10 -59
- package/dist/model/RWService.d.ts +1 -1
- package/dist/model/RWService.d.ts.map +1 -1
- package/dist/model/RWService.js +2 -2
- package/dist/model/RWServiceFunction.d.ts +2 -2
- package/dist/model/RWServiceFunction.d.ts.map +1 -1
- package/dist/model/RWServiceFunction.js +5 -6
- package/dist/model/RWTOML.d.ts +2 -2
- package/dist/model/RWTOML.d.ts.map +1 -1
- package/dist/model/RWTOML.js +6 -6
- package/dist/model/util/process_env.d.ts +9 -18
- package/dist/model/util/process_env.d.ts.map +1 -1
- package/dist/model/util/process_env.js +25 -34
- package/dist/nodes.d.ts +62 -0
- package/dist/nodes.d.ts.map +1 -0
- package/dist/nodes.js +175 -0
- package/dist/x/Location.d.ts +9 -0
- package/dist/x/Location.d.ts.map +1 -0
- package/dist/x/Location.js +18 -0
- package/dist/x/Position.d.ts +12 -0
- package/dist/x/Position.d.ts.map +1 -0
- package/dist/x/Position.js +35 -0
- package/dist/x/Range.d.ts +8 -0
- package/dist/x/Range.d.ts.map +1 -0
- package/dist/x/Range.js +22 -0
- package/dist/x/{vscode-languageserver-types.d.ts → diagnostics.d.ts} +27 -36
- package/dist/x/diagnostics.d.ts.map +1 -0
- package/dist/x/{vscode-languageserver-types.js → diagnostics.js} +30 -135
- package/dist/x/path.d.ts +1 -0
- package/dist/x/path.d.ts.map +1 -1
- package/dist/x/path.js +25 -17
- package/dist/x/prisma.d.ts +2 -3
- package/dist/x/prisma.d.ts.map +1 -1
- package/dist/x/prisma.js +5 -5
- package/package.json +3 -8
- package/dist/hosts.d.ts +0 -23
- package/dist/hosts.d.ts.map +0 -1
- package/dist/hosts.js +0 -44
- package/dist/ide.d.ts +0 -122
- package/dist/ide.d.ts.map +0 -1
- package/dist/ide.js +0 -240
- package/dist/interactive_cli/RedwoodCommandString.d.ts +0 -20
- package/dist/interactive_cli/RedwoodCommandString.d.ts.map +0 -1
- package/dist/interactive_cli/RedwoodCommandString.js +0 -72
- package/dist/interactive_cli/command_builder.d.ts +0 -10
- package/dist/interactive_cli/command_builder.d.ts.map +0 -1
- package/dist/interactive_cli/command_builder.js +0 -196
- package/dist/interactive_cli/dry_run.d.ts +0 -28
- package/dist/interactive_cli/dry_run.d.ts.map +0 -1
- package/dist/interactive_cli/dry_run.js +0 -104
- package/dist/interactive_cli/ui.d.ts +0 -32
- package/dist/interactive_cli/ui.d.ts.map +0 -1
- package/dist/interactive_cli/ui.js +0 -84
- package/dist/language_server/RWLanguageServer.d.ts +0 -30
- package/dist/language_server/RWLanguageServer.d.ts.map +0 -1
- package/dist/language_server/RWLanguageServer.js +0 -201
- package/dist/language_server/commands.d.ts +0 -14
- package/dist/language_server/commands.d.ts.map +0 -1
- package/dist/language_server/commands.js +0 -122
- package/dist/language_server/diagnostics.d.ts +0 -10
- package/dist/language_server/diagnostics.d.ts.map +0 -1
- package/dist/language_server/diagnostics.js +0 -61
- package/dist/language_server/outline.d.ts +0 -7
- package/dist/language_server/outline.d.ts.map +0 -1
- package/dist/language_server/outline.js +0 -37
- package/dist/language_server/start.d.ts +0 -2
- package/dist/language_server/start.d.ts.map +0 -1
- package/dist/language_server/start.js +0 -4
- package/dist/language_server/xmethods.d.ts +0 -11
- package/dist/language_server/xmethods.d.ts.map +0 -1
- package/dist/language_server/xmethods.js +0 -42
- package/dist/model/util/advanced_path_parser.d.ts +0 -12
- package/dist/model/util/advanced_path_parser.d.ts.map +0 -1
- package/dist/model/util/advanced_path_parser.js +0 -38
- package/dist/outline/index.d.ts +0 -3
- package/dist/outline/index.d.ts.map +0 -1
- package/dist/outline/index.js +0 -31
- package/dist/outline/outline.d.ts +0 -4
- package/dist/outline/outline.d.ts.map +0 -1
- package/dist/outline/outline.js +0 -262
- package/dist/outline/types.d.ts +0 -87
- package/dist/outline/types.d.ts.map +0 -1
- package/dist/outline/types.js +0 -72
- package/dist/x/vscode-languageserver-types.d.ts.map +0 -1
- package/dist/x/vscode-languageserver.d.ts +0 -12
- package/dist/x/vscode-languageserver.d.ts.map +0 -1
- package/dist/x/vscode-languageserver.js +0 -61
- package/dist/x/vscode.d.ts +0 -126
- package/dist/x/vscode.d.ts.map +0 -1
- package/dist/x/vscode.js +0 -294
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
5
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.RWLanguageServer = void 0;
|
|
9
|
-
require("core-js/modules/es.array.push.js");
|
|
10
|
-
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/map"));
|
|
11
|
-
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/filter"));
|
|
12
|
-
var _getOwnPropertyDescriptor = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/get-own-property-descriptor"));
|
|
13
|
-
var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/applyDecoratedDescriptor"));
|
|
14
|
-
var _vscodeLanguageserver = require("vscode-languageserver");
|
|
15
|
-
var _vscodeLanguageserverTextdocument = require("vscode-languageserver-textdocument");
|
|
16
|
-
var _ide = require("../ide");
|
|
17
|
-
var _model = require("../model");
|
|
18
|
-
var _decorators = require("../x/decorators");
|
|
19
|
-
var _URL = require("../x/URL");
|
|
20
|
-
var _vscode = require("../x/vscode");
|
|
21
|
-
var _vscodeLanguageserver2 = require("../x/vscode-languageserver");
|
|
22
|
-
var _vscodeLanguageserverTypes = require("../x/vscode-languageserver-types");
|
|
23
|
-
var _commands = require("./commands");
|
|
24
|
-
var _diagnostics = require("./diagnostics");
|
|
25
|
-
var _outline = require("./outline");
|
|
26
|
-
var _xmethods = require("./xmethods");
|
|
27
|
-
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _class;
|
|
28
|
-
let RWLanguageServer = exports.RWLanguageServer = (_dec = (0, _decorators.lazy)(), _dec2 = (0, _decorators.memo)(), _dec3 = (0, _decorators.lazy)(), _dec4 = (0, _decorators.lazy)(), _dec5 = (0, _decorators.lazy)(), _dec6 = (0, _decorators.lazy)(), _dec7 = (0, _decorators.lazy)(), _class = class RWLanguageServer {
|
|
29
|
-
constructor() {
|
|
30
|
-
this.initializeParams = void 0;
|
|
31
|
-
this.documents = new _vscodeLanguageserver.TextDocuments(_vscodeLanguageserverTextdocument.TextDocument);
|
|
32
|
-
this.projectRoot = void 0;
|
|
33
|
-
}
|
|
34
|
-
get connection() {
|
|
35
|
-
const c = (0, _vscodeLanguageserver.createConnection)(_vscodeLanguageserver.ProposedFeatures.all);
|
|
36
|
-
(0, _vscodeLanguageserver2.Connection_suppressErrors)(c);
|
|
37
|
-
return c;
|
|
38
|
-
}
|
|
39
|
-
start() {
|
|
40
|
-
const {
|
|
41
|
-
connection,
|
|
42
|
-
documents
|
|
43
|
-
} = this;
|
|
44
|
-
connection.onInitialize(params => {
|
|
45
|
-
connection.console.log(`Redwood Language Server onInitialize(), PID=${process.pid}`);
|
|
46
|
-
this.initializeParams = params;
|
|
47
|
-
return {
|
|
48
|
-
capabilities: {
|
|
49
|
-
textDocumentSync: {
|
|
50
|
-
openClose: true,
|
|
51
|
-
change: _vscodeLanguageserver.TextDocumentSyncKind.Full
|
|
52
|
-
},
|
|
53
|
-
implementationProvider: true,
|
|
54
|
-
definitionProvider: true,
|
|
55
|
-
codeActionProvider: true,
|
|
56
|
-
codeLensProvider: {
|
|
57
|
-
resolveProvider: false
|
|
58
|
-
},
|
|
59
|
-
executeCommandProvider: this.commands.options,
|
|
60
|
-
documentLinkProvider: {
|
|
61
|
-
resolveProvider: false
|
|
62
|
-
},
|
|
63
|
-
hoverProvider: true
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
});
|
|
67
|
-
connection.onInitialized(async () => {
|
|
68
|
-
connection.console.log('Redwood Language Server onInitialized()');
|
|
69
|
-
const folders = await connection.workspace.getWorkspaceFolders();
|
|
70
|
-
if (folders) {
|
|
71
|
-
for (const folder of folders) {
|
|
72
|
-
this.projectRoot = (0, _URL.URL_toFile)(folder.uri);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
// initialize these early on to prevent "unhandled methods"
|
|
78
|
-
// they are smart enough to short-circuit if this.projectRoot is not ready
|
|
79
|
-
this.diagnostics.start();
|
|
80
|
-
this.commands.start();
|
|
81
|
-
this.outline.start();
|
|
82
|
-
this.xmethods.start();
|
|
83
|
-
connection.onImplementation(async ({
|
|
84
|
-
textDocument: {
|
|
85
|
-
uri
|
|
86
|
-
},
|
|
87
|
-
position
|
|
88
|
-
}) => {
|
|
89
|
-
const info = await this.info(uri, 'Implementation');
|
|
90
|
-
for (const i of info) {
|
|
91
|
-
if ((0, _vscodeLanguageserverTypes.Range_contains)(i.location.range, position)) {
|
|
92
|
-
return i.target;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
connection.onDefinition(async ({
|
|
97
|
-
textDocument: {
|
|
98
|
-
uri
|
|
99
|
-
},
|
|
100
|
-
position
|
|
101
|
-
}) => {
|
|
102
|
-
const info = await this.info(uri, 'Definition');
|
|
103
|
-
for (const i of info) {
|
|
104
|
-
if ((0, _vscodeLanguageserverTypes.Range_contains)(i.location.range, position)) {
|
|
105
|
-
return i.target;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
connection.onDocumentLinks(async ({
|
|
110
|
-
textDocument: {
|
|
111
|
-
uri
|
|
112
|
-
}
|
|
113
|
-
}) => {
|
|
114
|
-
var _context;
|
|
115
|
-
return (0, _map.default)(_context = await this.info(uri, 'DocumentLink')).call(_context, i => i.link);
|
|
116
|
-
});
|
|
117
|
-
connection.onCodeAction(async ({
|
|
118
|
-
context,
|
|
119
|
-
textDocument: {
|
|
120
|
-
uri
|
|
121
|
-
}
|
|
122
|
-
}) => {
|
|
123
|
-
const actions = [];
|
|
124
|
-
const node = await this.getProject()?.findNode(uri);
|
|
125
|
-
if (!node) {
|
|
126
|
-
return [];
|
|
127
|
-
}
|
|
128
|
-
if (context.diagnostics.length > 0) {
|
|
129
|
-
// find quick-fixes associated to diagnostics
|
|
130
|
-
const xds = await node.collectDiagnostics();
|
|
131
|
-
for (const xd of xds) {
|
|
132
|
-
const as = await (0, _vscodeLanguageserverTypes.ExtendedDiagnostic_findRelevantQuickFixes)(xd, context);
|
|
133
|
-
for (const a of as) {
|
|
134
|
-
actions.push(a);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return actions;
|
|
139
|
-
});
|
|
140
|
-
connection.onCodeLens(async ({
|
|
141
|
-
textDocument: {
|
|
142
|
-
uri
|
|
143
|
-
}
|
|
144
|
-
}) => {
|
|
145
|
-
var _context2;
|
|
146
|
-
return (0, _map.default)(_context2 = await this.info(uri, 'CodeLens')).call(_context2, i => i.codeLens);
|
|
147
|
-
});
|
|
148
|
-
connection.onHover(async ({
|
|
149
|
-
textDocument: {
|
|
150
|
-
uri
|
|
151
|
-
},
|
|
152
|
-
position
|
|
153
|
-
}) => {
|
|
154
|
-
const info = await this.info(uri, 'Hover');
|
|
155
|
-
for (const i of info) {
|
|
156
|
-
if ((0, _vscodeLanguageserverTypes.Range_contains)(i.hover.range, position)) {
|
|
157
|
-
return i.hover;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
documents.listen(connection);
|
|
162
|
-
connection.listen();
|
|
163
|
-
}
|
|
164
|
-
get diagnostics() {
|
|
165
|
-
return new _diagnostics.DiagnosticsManager(this);
|
|
166
|
-
}
|
|
167
|
-
get commands() {
|
|
168
|
-
return new _commands.CommandsManager(this);
|
|
169
|
-
}
|
|
170
|
-
get outline() {
|
|
171
|
-
return new _outline.OutlineManager(this);
|
|
172
|
-
}
|
|
173
|
-
get xmethods() {
|
|
174
|
-
return new _xmethods.XMethodsManager(this);
|
|
175
|
-
}
|
|
176
|
-
get host() {
|
|
177
|
-
return new _ide.HostWithDocumentsStore(this.documents);
|
|
178
|
-
}
|
|
179
|
-
getProject() {
|
|
180
|
-
if (!this.projectRoot) {
|
|
181
|
-
return undefined;
|
|
182
|
-
}
|
|
183
|
-
return new _model.RWProject({
|
|
184
|
-
projectRoot: this.projectRoot,
|
|
185
|
-
host: this.host
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
get vscodeWindowMethods() {
|
|
189
|
-
return (0, _vscode.VSCodeWindowMethods_fromConnection)(this.connection);
|
|
190
|
-
}
|
|
191
|
-
async collectIDEInfo(uri) {
|
|
192
|
-
return (await this.getProject()?.collectIDEInfo(uri)) ?? [];
|
|
193
|
-
}
|
|
194
|
-
async info(uri, kind) {
|
|
195
|
-
var _context3;
|
|
196
|
-
return (0, _filter.default)(_context3 = await this.collectIDEInfo(uri)).call(_context3, i => i.kind === kind);
|
|
197
|
-
}
|
|
198
|
-
get hasWorkspaceFolderCapability() {
|
|
199
|
-
return this.initializeParams.capabilities.workspace?.workspaceFolders === true;
|
|
200
|
-
}
|
|
201
|
-
}, (0, _applyDecoratedDescriptor2.default)(_class.prototype, "connection", [_dec], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "connection"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "start", [_dec2], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "start"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "diagnostics", [_dec3], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "diagnostics"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "commands", [_dec4], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "commands"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "outline", [_dec5], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "outline"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "xmethods", [_dec6], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "xmethods"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "host", [_dec7], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "host"), _class.prototype), _class);
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { ExecuteCommandOptions } from 'vscode-languageserver';
|
|
2
|
-
import type { RWLanguageServer } from './RWLanguageServer';
|
|
3
|
-
export declare const redwoodjs_commands: {
|
|
4
|
-
'redwoodjs.cli': string;
|
|
5
|
-
};
|
|
6
|
-
export type CommandID = keyof typeof redwoodjs_commands;
|
|
7
|
-
export declare class CommandsManager {
|
|
8
|
-
server: RWLanguageServer;
|
|
9
|
-
constructor(server: RWLanguageServer);
|
|
10
|
-
get options(): ExecuteCommandOptions;
|
|
11
|
-
start(): void;
|
|
12
|
-
private command__cli;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=commands.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/language_server/commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAclE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,eAAO,MAAM,kBAAkB;;CAE9B,CAAA;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,kBAAkB,CAAA;AAEvD,qBAAa,eAAe;IACP,MAAM,EAAE,gBAAgB;gBAAxB,MAAM,EAAE,gBAAgB;IAE3C,IAAY,OAAO,IAAI,qBAAqB,CAK3C;IAEO,KAAK;YAWC,YAAY;CAiE3B"}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
5
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.redwoodjs_commands = exports.CommandsManager = void 0;
|
|
9
|
-
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/keys"));
|
|
10
|
-
var _startsWith = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/starts-with"));
|
|
11
|
-
var _getOwnPropertyDescriptor = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/get-own-property-descriptor"));
|
|
12
|
-
var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/applyDecoratedDescriptor"));
|
|
13
|
-
var _command_builder = require("../interactive_cli/command_builder");
|
|
14
|
-
var _dry_run = require("../interactive_cli/dry_run");
|
|
15
|
-
var _RedwoodCommandString = require("../interactive_cli/RedwoodCommandString");
|
|
16
|
-
var _ui = require("../interactive_cli/ui");
|
|
17
|
-
var _model = require("../model");
|
|
18
|
-
var _decorators = require("../x/decorators");
|
|
19
|
-
var _URL = require("../x/URL");
|
|
20
|
-
var _vscodeLanguageserverTypes = require("../x/vscode-languageserver-types");
|
|
21
|
-
var _dec, _dec2, _class;
|
|
22
|
-
const redwoodjs_commands = exports.redwoodjs_commands = {
|
|
23
|
-
'redwoodjs.cli': 'redwoodjs.cli'
|
|
24
|
-
};
|
|
25
|
-
let CommandsManager = exports.CommandsManager = (_dec = (0, _decorators.lazy)(), _dec2 = (0, _decorators.memo)(), _class = class CommandsManager {
|
|
26
|
-
constructor(server) {
|
|
27
|
-
this.server = server;
|
|
28
|
-
}
|
|
29
|
-
get options() {
|
|
30
|
-
return {
|
|
31
|
-
commands: (0, _keys.default)(redwoodjs_commands),
|
|
32
|
-
workDoneProgress: true
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
start() {
|
|
36
|
-
const {
|
|
37
|
-
connection
|
|
38
|
-
} = this.server;
|
|
39
|
-
connection.onExecuteCommand(async params => {
|
|
40
|
-
if (params.command === redwoodjs_commands['redwoodjs.cli']) {
|
|
41
|
-
const [cmd, cwd] = params.arguments ?? [];
|
|
42
|
-
await this.command__cli(cmd, cwd);
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// --- start command implementations
|
|
48
|
-
async command__cli(cmdString, cwd) {
|
|
49
|
-
var _context, _context2;
|
|
50
|
-
const {
|
|
51
|
-
vscodeWindowMethods,
|
|
52
|
-
host,
|
|
53
|
-
projectRoot,
|
|
54
|
-
connection,
|
|
55
|
-
documents
|
|
56
|
-
} = this.server;
|
|
57
|
-
cwd = cwd ?? projectRoot;
|
|
58
|
-
if (!cwd) {
|
|
59
|
-
return;
|
|
60
|
-
} // we need a cwd to run the CLI
|
|
61
|
-
// parse the cmd. this will do some checks and throw
|
|
62
|
-
let cmd = new _RedwoodCommandString.RedwoodCommandString(cmdString ?? '...');
|
|
63
|
-
if ((0, _startsWith.default)(_context = cmd.processed).call(_context, 'dev --open') || (0, _startsWith.default)(_context2 = cmd.processed).call(_context2, 'storybook --open')) {
|
|
64
|
-
vscodeWindowMethods.showInformationMessage('not implemented yet: $ redwood ' + cmd.processed);
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
if (!cmd.isComplete) {
|
|
68
|
-
// if the command is incomplete, we need to build it interactively
|
|
69
|
-
const project = new _model.RWProject({
|
|
70
|
-
projectRoot: cwd,
|
|
71
|
-
host
|
|
72
|
-
});
|
|
73
|
-
// the interactive builder needs a UI to prompt the user
|
|
74
|
-
// this UI is provided by the client side VSCode extension
|
|
75
|
-
// (it is not a standard part of the LSP)
|
|
76
|
-
// we have a convenience wrapper to access it
|
|
77
|
-
const ui = new _ui.VSCodeWindowUI(vscodeWindowMethods);
|
|
78
|
-
const cmd2 = await (0, _command_builder.command_builder)({
|
|
79
|
-
cmd,
|
|
80
|
-
project,
|
|
81
|
-
ui
|
|
82
|
-
});
|
|
83
|
-
if (!cmd2) {
|
|
84
|
-
return;
|
|
85
|
-
} // user cancelled the interactive process
|
|
86
|
-
cmd = cmd2;
|
|
87
|
-
}
|
|
88
|
-
// run the command
|
|
89
|
-
if (cmd.isInterceptable) {
|
|
90
|
-
// TODO: we could use the LSP progress API
|
|
91
|
-
vscodeWindowMethods.showInformationMessage('redwood ' + cmd.processed);
|
|
92
|
-
// run using dry_run so we can intercept the generated files
|
|
93
|
-
const fileOverrides = (0, _vscodeLanguageserverTypes.FileSet_fromTextDocuments)(documents);
|
|
94
|
-
const {
|
|
95
|
-
stdout,
|
|
96
|
-
files
|
|
97
|
-
} = await (0, _dry_run.redwood_gen_dry_run)({
|
|
98
|
-
cmd,
|
|
99
|
-
cwd,
|
|
100
|
-
fileOverrides
|
|
101
|
-
});
|
|
102
|
-
const edit = (0, _vscodeLanguageserverTypes.WorkspaceEdit_fromFileSet)(files, f => {
|
|
103
|
-
if (!host.existsSync((0, _URL.URL_toFile)(f))) {
|
|
104
|
-
return undefined;
|
|
105
|
-
}
|
|
106
|
-
return host.readFileSync((0, _URL.URL_toFile)(f));
|
|
107
|
-
});
|
|
108
|
-
vscodeWindowMethods.showInformationMessage(stdout);
|
|
109
|
-
await connection.workspace.applyEdit({
|
|
110
|
-
label: 'redwood ' + cmd.processed,
|
|
111
|
-
edit
|
|
112
|
-
});
|
|
113
|
-
} else {
|
|
114
|
-
// if it can't be intercepted, just run in the terminal
|
|
115
|
-
vscodeWindowMethods.createTerminal2({
|
|
116
|
-
name: 'Redwood',
|
|
117
|
-
cwd,
|
|
118
|
-
cmd: 'yarn cedar ' + cmd.processed
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}, (0, _applyDecoratedDescriptor2.default)(_class.prototype, "options", [_dec], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "options"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "start", [_dec2], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "start"), _class.prototype), _class);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { RWLanguageServer } from './RWLanguageServer';
|
|
2
|
-
export declare class DiagnosticsManager {
|
|
3
|
-
server: RWLanguageServer;
|
|
4
|
-
constructor(server: RWLanguageServer);
|
|
5
|
-
start(): void;
|
|
6
|
-
private previousURIs;
|
|
7
|
-
private refreshDiagnostics;
|
|
8
|
-
private getDiagnosticsGroupedByUri;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=diagnostics.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/language_server/diagnostics.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAK1D,qBAAa,kBAAkB;IACV,MAAM,EAAE,gBAAgB;gBAAxB,MAAM,EAAE,gBAAgB;IAEnC,KAAK;IAcb,OAAO,CAAC,YAAY,CAAe;YAGrB,kBAAkB;YAWlB,0BAA0B;CAQzC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
5
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.DiagnosticsManager = void 0;
|
|
9
|
-
var _setInterval2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/set-interval"));
|
|
10
|
-
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/keys"));
|
|
11
|
-
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/concat"));
|
|
12
|
-
var _getOwnPropertyDescriptor = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/get-own-property-descriptor"));
|
|
13
|
-
var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/applyDecoratedDescriptor"));
|
|
14
|
-
var _decorators = require("../x/decorators");
|
|
15
|
-
var _vscodeLanguageserverTypes = require("../x/vscode-languageserver-types");
|
|
16
|
-
var _dec, _dec2, _class;
|
|
17
|
-
const REFRESH_DIAGNOSTICS_INTERVAL = 5000;
|
|
18
|
-
const REFRESH_DIAGNOSTICS_DEBOUNCE = 500;
|
|
19
|
-
let DiagnosticsManager = exports.DiagnosticsManager = (_dec = (0, _decorators.memo)(), _dec2 = (0, _decorators.debounce)(REFRESH_DIAGNOSTICS_DEBOUNCE), _class = class DiagnosticsManager {
|
|
20
|
-
constructor(server) {
|
|
21
|
-
// we need to keep track of URIs so we can "erase" previous diagnostics
|
|
22
|
-
this.previousURIs = [];
|
|
23
|
-
this.server = server;
|
|
24
|
-
}
|
|
25
|
-
start() {
|
|
26
|
-
(0, _setInterval2.default)(() => this.refreshDiagnostics(), REFRESH_DIAGNOSTICS_INTERVAL);
|
|
27
|
-
// The content of a text document has changed. This event is emitted
|
|
28
|
-
// when the text document first opened or when its content has changed.
|
|
29
|
-
const {
|
|
30
|
-
documents,
|
|
31
|
-
connection
|
|
32
|
-
} = this.server;
|
|
33
|
-
documents.onDidChangeContent(() => {
|
|
34
|
-
this.refreshDiagnostics();
|
|
35
|
-
});
|
|
36
|
-
connection.onDidChangeWatchedFiles(() => {
|
|
37
|
-
this.refreshDiagnostics();
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
async refreshDiagnostics() {
|
|
41
|
-
const dss = await this.getDiagnosticsGroupedByUri();
|
|
42
|
-
const newURIs = (0, _keys.default)(dss);
|
|
43
|
-
const allURIs = (0, _concat.default)(newURIs).call(newURIs, this.previousURIs);
|
|
44
|
-
this.previousURIs = newURIs;
|
|
45
|
-
for (const uri of allURIs) {
|
|
46
|
-
const diagnostics = dss[uri] ?? [];
|
|
47
|
-
this.server.connection.sendDiagnostics({
|
|
48
|
-
uri,
|
|
49
|
-
diagnostics
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
async getDiagnosticsGroupedByUri() {
|
|
54
|
-
const project = this.server.getProject();
|
|
55
|
-
if (!project) {
|
|
56
|
-
return {};
|
|
57
|
-
}
|
|
58
|
-
const ds = await project.collectDiagnostics();
|
|
59
|
-
return (0, _vscodeLanguageserverTypes.ExtendedDiagnostic_groupByUri)(ds);
|
|
60
|
-
}
|
|
61
|
-
}, (0, _applyDecoratedDescriptor2.default)(_class.prototype, "start", [_dec], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "start"), _class.prototype), (0, _applyDecoratedDescriptor2.default)(_class.prototype, "refreshDiagnostics", [_dec2], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "refreshDiagnostics"), _class.prototype), _class);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"outline.d.ts","sourceRoot":"","sources":["../../src/language_server/outline.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,qBAAa,cAAc;IACN,MAAM,EAAE,gBAAgB;gBAAxB,MAAM,EAAE,gBAAgB;IAEnC,KAAK;CAoBd"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
5
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.OutlineManager = void 0;
|
|
9
|
-
var _getOwnPropertyDescriptor = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/get-own-property-descriptor"));
|
|
10
|
-
var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/applyDecoratedDescriptor"));
|
|
11
|
-
var _outline = require("../outline/outline");
|
|
12
|
-
var _decorators = require("../x/decorators");
|
|
13
|
-
var _vscode = require("../x/vscode");
|
|
14
|
-
var _dec, _class;
|
|
15
|
-
let OutlineManager = exports.OutlineManager = (_dec = (0, _decorators.memo)(), _class = class OutlineManager {
|
|
16
|
-
constructor(server) {
|
|
17
|
-
this.server = server;
|
|
18
|
-
}
|
|
19
|
-
start() {
|
|
20
|
-
const getRoot = () => {
|
|
21
|
-
const p = this.server.getProject();
|
|
22
|
-
if (!p) {
|
|
23
|
-
return {
|
|
24
|
-
async children() {
|
|
25
|
-
return [{
|
|
26
|
-
label: 'No Redwood.js project found...'
|
|
27
|
-
}];
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
return (0, _outline.getOutline)(p);
|
|
32
|
-
};
|
|
33
|
-
const tdp = new _vscode.RemoteTreeDataProviderImpl(getRoot);
|
|
34
|
-
const methodPrefix = 'redwoodjs/x-outline-';
|
|
35
|
-
(0, _vscode.RemoteTreeDataProvider_publishOverLSPConnection)(tdp, this.server.connection, methodPrefix);
|
|
36
|
-
}
|
|
37
|
-
}, (0, _applyDecoratedDescriptor2.default)(_class.prototype, "start", [_dec], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "start"), _class.prototype), _class);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/language_server/start.ts"],"names":[],"mappings":""}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { RWLanguageServer } from './RWLanguageServer';
|
|
2
|
-
/**
|
|
3
|
-
* A set of custom methods (not included in the LSP spec) exposed to the client
|
|
4
|
-
* via the sendRequest/onRequest mechanism.
|
|
5
|
-
*/
|
|
6
|
-
export declare class XMethodsManager {
|
|
7
|
-
server: RWLanguageServer;
|
|
8
|
-
constructor(server: RWLanguageServer);
|
|
9
|
-
start(): void;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=xmethods.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xmethods.d.ts","sourceRoot":"","sources":["../../src/language_server/xmethods.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D;;;GAGG;AACH,qBAAa,eAAe;IACP,MAAM,EAAE,gBAAgB;gBAAxB,MAAM,EAAE,gBAAgB;IACnC,KAAK;CAuBd"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
5
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.XMethodsManager = void 0;
|
|
9
|
-
var _getOwnPropertyDescriptor = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/object/get-own-property-descriptor"));
|
|
10
|
-
var _applyDecoratedDescriptor2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/applyDecoratedDescriptor"));
|
|
11
|
-
var _decorators = require("../x/decorators");
|
|
12
|
-
var _dec, _class;
|
|
13
|
-
/**
|
|
14
|
-
* A set of custom methods (not included in the LSP spec) exposed to the client
|
|
15
|
-
* via the sendRequest/onRequest mechanism.
|
|
16
|
-
*/
|
|
17
|
-
let XMethodsManager = exports.XMethodsManager = (_dec = (0, _decorators.memo)(), _class = class XMethodsManager {
|
|
18
|
-
constructor(server) {
|
|
19
|
-
this.server = server;
|
|
20
|
-
}
|
|
21
|
-
start() {
|
|
22
|
-
const {
|
|
23
|
-
server
|
|
24
|
-
} = this;
|
|
25
|
-
const {
|
|
26
|
-
connection
|
|
27
|
-
} = server;
|
|
28
|
-
connection.onRequest('redwoodjs/x-getInfo', async uri => {
|
|
29
|
-
const node = await server.getProject()?.findNode(uri);
|
|
30
|
-
if (!node) {
|
|
31
|
-
return undefined;
|
|
32
|
-
}
|
|
33
|
-
return await node.collectIDEInfo();
|
|
34
|
-
});
|
|
35
|
-
connection.onRequest('redwoodjs/x-getFilePathForRoutePath', routePath => {
|
|
36
|
-
return server.getProject()?.router.getFilePathForRoutePath(routePath);
|
|
37
|
-
});
|
|
38
|
-
connection.onRequest('redwoodjs/x-getRoutePathForFilePath', uri => {
|
|
39
|
-
return server.getProject()?.router.getRoutePathForFilePath(uri);
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}, (0, _applyDecoratedDescriptor2.default)(_class.prototype, "start", [_dec], (0, _getOwnPropertyDescriptor.default)(_class.prototype, "start"), _class.prototype), _class);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A route path parser with positional information.
|
|
3
|
-
* Used to enable decorations
|
|
4
|
-
* @param route
|
|
5
|
-
*/
|
|
6
|
-
export declare function advanced_path_parser(route: string): {
|
|
7
|
-
punctuationIndexes: number[];
|
|
8
|
-
slashIndexes: number[];
|
|
9
|
-
paramRanges: [number, number][];
|
|
10
|
-
paramTypeRanges: [number, number][];
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=advanced_path_parser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"advanced_path_parser.d.ts","sourceRoot":"","sources":["../../../src/model/util/advanced_path_parser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM;;;;;EAejD"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
|
5
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.advanced_path_parser = advanced_path_parser;
|
|
9
|
-
require("core-js/modules/es.array.push.js");
|
|
10
|
-
var _matchAll = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/match-all"));
|
|
11
|
-
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/map"));
|
|
12
|
-
/**
|
|
13
|
-
* A route path parser with positional information.
|
|
14
|
-
* Used to enable decorations
|
|
15
|
-
* @param route
|
|
16
|
-
*/
|
|
17
|
-
function advanced_path_parser(route) {
|
|
18
|
-
var _context, _context2;
|
|
19
|
-
const paramRanges = [];
|
|
20
|
-
const paramTypeRanges = [];
|
|
21
|
-
for (const param of (0, _matchAll.default)(route).call(route, /\{([^}]+)\}/g)) {
|
|
22
|
-
const [paramName, paramType] = param[1].split(':');
|
|
23
|
-
const index = param.index + 1;
|
|
24
|
-
paramRanges.push([index, index + paramName.length]);
|
|
25
|
-
if (paramType) {
|
|
26
|
-
const typeIndex = index + paramName.length + 2;
|
|
27
|
-
paramTypeRanges.push([typeIndex, typeIndex + paramType.length]);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
const punctuationIndexes = (0, _map.default)(_context = [...(0, _matchAll.default)(route).call(route, /[{}:]/g)]).call(_context, x => x.index);
|
|
31
|
-
const slashIndexes = (0, _map.default)(_context2 = [...(0, _matchAll.default)(route).call(route, /[\/]/g)]).call(_context2, x => x.index);
|
|
32
|
-
return {
|
|
33
|
-
punctuationIndexes,
|
|
34
|
-
slashIndexes,
|
|
35
|
-
paramRanges,
|
|
36
|
-
paramTypeRanges
|
|
37
|
-
};
|
|
38
|
-
}
|
package/dist/outline/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/outline/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA"}
|
package/dist/outline/index.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _context, _context2;
|
|
4
|
-
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");
|
|
5
|
-
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js/instance/for-each");
|
|
6
|
-
var _Object$keys = require("@babel/runtime-corejs3/core-js/object/keys");
|
|
7
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
var _types = require("./types");
|
|
11
|
-
_forEachInstanceProperty(_context = _Object$keys(_types)).call(_context, function (key) {
|
|
12
|
-
if (key === "default" || key === "__esModule") return;
|
|
13
|
-
if (key in exports && exports[key] === _types[key]) return;
|
|
14
|
-
_Object$defineProperty(exports, key, {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function () {
|
|
17
|
-
return _types[key];
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
var _outline = require("./outline");
|
|
22
|
-
_forEachInstanceProperty(_context2 = _Object$keys(_outline)).call(_context2, function (key) {
|
|
23
|
-
if (key === "default" || key === "__esModule") return;
|
|
24
|
-
if (key in exports && exports[key] === _outline[key]) return;
|
|
25
|
-
_Object$defineProperty(exports, key, {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () {
|
|
28
|
-
return _outline[key];
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"outline.d.ts","sourceRoot":"","sources":["../../src/outline/outline.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAIzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAG5C,wBAAgB,UAAU,CAAC,OAAO,EAAE,SAAS,GAAG,SAAS,CA0DxD"}
|