@analogjs/language-server 0.1.4 → 0.1.5
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/out/languagePlugin.js +29 -4
- package/package.json +1 -1
package/out/languagePlugin.js
CHANGED
|
@@ -144,7 +144,11 @@ function createAnalogCode(snapshot) {
|
|
|
144
144
|
if (root.tag === "script" &&
|
|
145
145
|
root.startTagEnd !== undefined &&
|
|
146
146
|
root.endTagStart !== undefined) {
|
|
147
|
-
const text = snapshot.getText(root.startTagEnd, root.endTagStart)
|
|
147
|
+
const text = snapshot.getText(root.startTagEnd, root.endTagStart).replace(/(with(((\n|\s)*).*)})/gm, function (_, _$1, $2) {
|
|
148
|
+
// replace "with { analog: 'imports' }" with "/**with { analog: 'imports' }*/"
|
|
149
|
+
// so its not evaluated inside the script tag
|
|
150
|
+
return `/**${$2}*/`;
|
|
151
|
+
});
|
|
148
152
|
const lang = root.attributes?.lang;
|
|
149
153
|
const isTs = lang === "ts" || lang === '"ts"' || lang === "'ts'";
|
|
150
154
|
yield {
|
|
@@ -152,16 +156,26 @@ function createAnalogCode(snapshot) {
|
|
|
152
156
|
languageId: isTs ? "typescript" : "javascript",
|
|
153
157
|
snapshot: {
|
|
154
158
|
getText: (start, end) => `${text.substring(start, end)}
|
|
159
|
+
|
|
160
|
+
type AnalogComponentMetadata = Omit<import('@angular/core').Component, "template" |
|
|
161
|
+
"standalone" |
|
|
162
|
+
"changeDetection" |
|
|
163
|
+
"styles" |
|
|
164
|
+
"outputs" |
|
|
165
|
+
"inputs"> & { exposes: any[] };
|
|
166
|
+
|
|
155
167
|
/**
|
|
156
168
|
* Defines additional metadata for the component such as the
|
|
157
169
|
* selector, providers, and more.
|
|
158
170
|
*/
|
|
159
|
-
declare function defineMetadata(metadata:
|
|
171
|
+
declare function defineMetadata(metadata: AnalogComponentMetadata): void;
|
|
172
|
+
|
|
160
173
|
/**
|
|
161
174
|
* Defines the lifecycle hook(ngOnInit) that is called when the
|
|
162
175
|
* component is initialized.
|
|
163
176
|
*/
|
|
164
|
-
declare function onInit(
|
|
177
|
+
declare function onInit(initFn: () => void): void;
|
|
178
|
+
|
|
165
179
|
/**
|
|
166
180
|
* Defines the lifecycle hook(ngOnDestroy) that is called when the
|
|
167
181
|
* component is destroyed.
|
|
@@ -217,7 +231,18 @@ declare function onDestroy(destroyFn: () => void): void;`,
|
|
|
217
231
|
},
|
|
218
232
|
},
|
|
219
233
|
],
|
|
220
|
-
embeddedCodes: [
|
|
234
|
+
embeddedCodes: [
|
|
235
|
+
{
|
|
236
|
+
id: "lang_" + langs + "_ts",
|
|
237
|
+
languageId: "typescript",
|
|
238
|
+
snapshot: {
|
|
239
|
+
getText: (_start, _end) => `increment();`,
|
|
240
|
+
getLength: () => `void increment;`.length,
|
|
241
|
+
getChangeRange: () => undefined,
|
|
242
|
+
},
|
|
243
|
+
mappings: []
|
|
244
|
+
}
|
|
245
|
+
],
|
|
221
246
|
};
|
|
222
247
|
}
|
|
223
248
|
}
|