@ripple-ts/language-server 0.3.54 → 0.3.56
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/dist/language-server.js +1 -2
- package/dist/language-server.js.map +1 -1
- package/dist/{typescriptService-mlv6mda-.js → server-BvQFo7aV.js} +233 -168
- package/dist/server-BvQFo7aV.js.map +1 -0
- package/dist/server.js +2 -109
- package/package.json +5 -5
- package/dist/server.js.map +0 -1
- package/dist/typescriptService-mlv6mda-.js.map +0 -1
|
@@ -6,7 +6,7 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
9
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
10
10
|
var __exportAll = (all, no_symbols) => {
|
|
11
11
|
let target = {};
|
|
12
12
|
for (var name in all) {
|
|
@@ -43,14 +43,15 @@ var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["modu
|
|
|
43
43
|
//#endregion
|
|
44
44
|
let vscode_uri = require("vscode-uri");
|
|
45
45
|
let path = require("path");
|
|
46
|
-
path = __toESM(path);
|
|
46
|
+
path = __toESM(path, 1);
|
|
47
47
|
let url = require("url");
|
|
48
48
|
let fs = require("fs");
|
|
49
|
-
fs = __toESM(fs);
|
|
49
|
+
fs = __toESM(fs, 1);
|
|
50
50
|
let typescript = require("typescript");
|
|
51
|
-
typescript = __toESM(typescript);
|
|
51
|
+
typescript = __toESM(typescript, 1);
|
|
52
52
|
let module$1 = require("module");
|
|
53
53
|
let node_module = require("node:module");
|
|
54
|
+
let volar_service_css = require("volar-service-css");
|
|
54
55
|
|
|
55
56
|
//#region ../typescript-plugin/src/utils.js
|
|
56
57
|
const DEBUG = process.env.RIPPLE_DEBUG === "true";
|
|
@@ -2001,7 +2002,7 @@ var require_connection$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2001
2002
|
const toCancel = messageQueue.get(key);
|
|
2002
2003
|
if (messages_1.Message.isRequest(toCancel)) {
|
|
2003
2004
|
const strategy = options?.connectionStrategy;
|
|
2004
|
-
const response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) :
|
|
2005
|
+
const response = strategy && strategy.cancelUndispatched ? strategy.cancelUndispatched(toCancel, cancelUndispatched) : void 0;
|
|
2005
2006
|
if (response && (response.error !== void 0 || response.result !== void 0)) {
|
|
2006
2007
|
messageQueue.delete(key);
|
|
2007
2008
|
requestTokens.delete(cancelId);
|
|
@@ -4095,6 +4096,10 @@ var require_main$3 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
4095
4096
|
} else this._workspaceEdit = {};
|
|
4096
4097
|
}
|
|
4097
4098
|
Object.defineProperty(WorkspaceChange.prototype, "edit", {
|
|
4099
|
+
/**
|
|
4100
|
+
* Returns the underlying {@link WorkspaceEdit} literal
|
|
4101
|
+
* use to be returned from a workspace edit operation like rename.
|
|
4102
|
+
*/
|
|
4098
4103
|
get: function() {
|
|
4099
4104
|
this.initDocumentChanges();
|
|
4100
4105
|
if (this._changeAnnotations !== void 0) if (this._changeAnnotations.size === 0) this._workspaceEdit.changeAnnotations = void 0;
|
|
@@ -18975,12 +18980,26 @@ var require_utilities = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
18975
18980
|
"jspm_packages"
|
|
18976
18981
|
].join("|")})(/|$))`;
|
|
18977
18982
|
const filesMatcher = {
|
|
18983
|
+
/**
|
|
18984
|
+
* Matches any single directory segment unless it is the last segment and a .min.js file
|
|
18985
|
+
* Breakdown:
|
|
18986
|
+
* [^./] # matches everything up to the first . character (excluding directory separators)
|
|
18987
|
+
* (\\.(?!min\\.js$))? # matches . characters but not if they are part of the .min.js file extension
|
|
18988
|
+
*/
|
|
18978
18989
|
singleAsteriskRegexFragment: "([^./]|(\\.(?!min\\.js$))?)*",
|
|
18990
|
+
/**
|
|
18991
|
+
* Regex for the ** wildcard. Matches any number of subdirectories. When used for including
|
|
18992
|
+
* files or directories, does not match subdirectories that start with a . character
|
|
18993
|
+
*/
|
|
18979
18994
|
doubleAsteriskRegexFragment: `(/${implicitExcludePathRegexPattern}[^/.][^/]*)*?`,
|
|
18980
18995
|
replaceWildcardCharacter: (match) => replaceWildcardCharacter(match, filesMatcher.singleAsteriskRegexFragment)
|
|
18981
18996
|
};
|
|
18982
18997
|
const directoriesMatcher = {
|
|
18983
18998
|
singleAsteriskRegexFragment: "[^/]*",
|
|
18999
|
+
/**
|
|
19000
|
+
* Regex for the ** wildcard. Matches any number of subdirectories. When used for including
|
|
19001
|
+
* files or directories, does not match subdirectories that start with a . character
|
|
19002
|
+
*/
|
|
18984
19003
|
doubleAsteriskRegexFragment: `(/${implicitExcludePathRegexPattern}[^/.][^/]*)*?`,
|
|
18985
19004
|
replaceWildcardCharacter: (match) => replaceWildcardCharacter(match, directoriesMatcher.singleAsteriskRegexFragment)
|
|
18986
19005
|
};
|
|
@@ -19970,6 +19989,7 @@ var require_node = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
19970
19989
|
|
|
19971
19990
|
//#endregion
|
|
19972
19991
|
//#region src/compileErrorDiagnosticPlugin.js
|
|
19992
|
+
var import_node = require_node();
|
|
19973
19993
|
/**
|
|
19974
19994
|
* @import {Diagnostic, Range, LanguageServicePlugin, LanguageServiceContext, Position, Mapper} from '@volar/language-server';
|
|
19975
19995
|
* @import {TextDocument} from 'vscode-languageserver-textdocument';
|
|
@@ -19977,12 +19997,12 @@ var require_node = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
19977
19997
|
*/
|
|
19978
19998
|
/** @import {TSRXCompileError} from '@tsrx/ripple'; */
|
|
19979
19999
|
var import_language_server = require_language_server();
|
|
19980
|
-
const { log: log$
|
|
20000
|
+
const { log: log$8 } = createLogging("[Ripple Compile Error Diagnostic Plugin]");
|
|
19981
20001
|
/**
|
|
19982
20002
|
* @returns {LanguageServicePlugin}
|
|
19983
20003
|
*/
|
|
19984
20004
|
function createCompileErrorDiagnosticPlugin() {
|
|
19985
|
-
log$
|
|
20005
|
+
log$8("Creating Ripple diagnostic plugin...");
|
|
19986
20006
|
return {
|
|
19987
20007
|
name: "ripple-diagnostics",
|
|
19988
20008
|
capabilities: { diagnosticProvider: {
|
|
@@ -19991,7 +20011,7 @@ function createCompileErrorDiagnosticPlugin() {
|
|
|
19991
20011
|
} },
|
|
19992
20012
|
create(context) {
|
|
19993
20013
|
return { provideDiagnostics(document, _token) {
|
|
19994
|
-
log$
|
|
20014
|
+
log$8("Providing Ripple diagnostics for:", document.uri);
|
|
19995
20015
|
/** @type {Diagnostic[]} */
|
|
19996
20016
|
const diagnostics = [];
|
|
19997
20017
|
const { virtualCode, sourceMap } = getVirtualCode(document, context);
|
|
@@ -20001,7 +20021,7 @@ function createCompileErrorDiagnosticPlugin() {
|
|
|
20001
20021
|
const diagnostic = parseCompilationErrorWithDocument(error, virtualCode, sourceMap, document);
|
|
20002
20022
|
diagnostics.push(diagnostic);
|
|
20003
20023
|
}
|
|
20004
|
-
log$
|
|
20024
|
+
log$8("Generated", diagnostics.length, "diagnostics");
|
|
20005
20025
|
return diagnostics;
|
|
20006
20026
|
} };
|
|
20007
20027
|
}
|
|
@@ -20094,6 +20114,7 @@ function get_start_offset_from_error(error) {
|
|
|
20094
20114
|
|
|
20095
20115
|
//#endregion
|
|
20096
20116
|
//#region ../typescript-plugin/src/language.js
|
|
20117
|
+
init_main();
|
|
20097
20118
|
/** @import { CodeMapping } from '@tsrx/ripple' */
|
|
20098
20119
|
/** @import {TSRXCompileError, VolarMappingsResult} from '@tsrx/ripple' */
|
|
20099
20120
|
/** @typedef {{ code?: string, errors?: TSRXCompileError[] }} TSRXCompileResult */
|
|
@@ -20109,7 +20130,7 @@ function get_start_offset_from_error(error) {
|
|
|
20109
20130
|
var import_language_core = require_language_core();
|
|
20110
20131
|
const require$2 = (0, module$1.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
20111
20132
|
const root_dirname = path.default.dirname((0, url.fileURLToPath)(require("url").pathToFileURL(__filename).href));
|
|
20112
|
-
const { log: log$
|
|
20133
|
+
const { log: log$7, logWarning, logError: logError$3 } = createLogging("[Ripple Language]");
|
|
20113
20134
|
/** @type {Set<string>} */
|
|
20114
20135
|
const loggedCompilationFailures = /* @__PURE__ */ new Set();
|
|
20115
20136
|
const RIPPLE_EXTENSIONS = [".tsrx"];
|
|
@@ -20183,12 +20204,12 @@ function is_ripple_file(file_name) {
|
|
|
20183
20204
|
* @returns {RippleLanguagePlugin}
|
|
20184
20205
|
*/
|
|
20185
20206
|
function getRippleLanguagePlugin() {
|
|
20186
|
-
log$
|
|
20207
|
+
log$7("Creating Ripple language plugin...");
|
|
20187
20208
|
return {
|
|
20188
20209
|
getLanguageId(fileNameOrUri) {
|
|
20189
20210
|
const file_name = typeof fileNameOrUri === "string" ? fileNameOrUri : fileNameOrUri.fsPath.replace(/\\/g, "/");
|
|
20190
20211
|
if (is_ripple_file(file_name)) {
|
|
20191
|
-
log$
|
|
20212
|
+
log$7("Identified Ripple file:", file_name);
|
|
20192
20213
|
return "ripple";
|
|
20193
20214
|
}
|
|
20194
20215
|
},
|
|
@@ -20197,21 +20218,21 @@ function getRippleLanguagePlugin() {
|
|
|
20197
20218
|
const file_name = normalizeFileNameOrUri(fileNameOrUri);
|
|
20198
20219
|
const ripple = get_tsrx_compiler(file_name);
|
|
20199
20220
|
if (!ripple) {
|
|
20200
|
-
logError$
|
|
20221
|
+
logError$3(`Ripple compiler not found for file: ${file_name}`);
|
|
20201
20222
|
return;
|
|
20202
20223
|
}
|
|
20203
|
-
log$
|
|
20224
|
+
log$7("Creating virtual code for:", file_name);
|
|
20204
20225
|
try {
|
|
20205
20226
|
return new TSRXVirtualCode(file_name, snapshot, ripple);
|
|
20206
20227
|
} catch (err) {
|
|
20207
|
-
logError$
|
|
20228
|
+
logError$3("Failed to create virtual code for:", file_name, ":", err);
|
|
20208
20229
|
throw err;
|
|
20209
20230
|
}
|
|
20210
20231
|
}
|
|
20211
20232
|
},
|
|
20212
20233
|
updateVirtualCode(fileNameOrUri, virtualCode, snapshot) {
|
|
20213
20234
|
if (virtualCode instanceof TSRXVirtualCode) {
|
|
20214
|
-
log$
|
|
20235
|
+
log$7("Updating existing virtual code for:", virtualCode.fileName);
|
|
20215
20236
|
virtualCode.update(snapshot);
|
|
20216
20237
|
return virtualCode;
|
|
20217
20238
|
}
|
|
@@ -20222,6 +20243,9 @@ function getRippleLanguagePlugin() {
|
|
|
20222
20243
|
isMixedContent: false,
|
|
20223
20244
|
scriptKind: 7
|
|
20224
20245
|
})),
|
|
20246
|
+
/**
|
|
20247
|
+
* @param {VirtualCode} ripple_code
|
|
20248
|
+
*/
|
|
20225
20249
|
getServiceScript(ripple_code) {
|
|
20226
20250
|
for (const code of (0, import_language_core.forEachEmbeddedCode)(ripple_code)) if (code.languageId === "ripple") return {
|
|
20227
20251
|
code,
|
|
@@ -20272,14 +20296,14 @@ var TSRXVirtualCode = class {
|
|
|
20272
20296
|
* @param {TSRXCompilerModule} tsrx
|
|
20273
20297
|
*/
|
|
20274
20298
|
constructor(file_name, snapshot, tsrx) {
|
|
20275
|
-
log$
|
|
20299
|
+
log$7("Initializing TSRXVirtualCode for:", file_name);
|
|
20276
20300
|
this.fileName = file_name;
|
|
20277
20301
|
this.tsrx = tsrx;
|
|
20278
20302
|
this.snapshot = snapshot;
|
|
20279
20303
|
this.sourceSnapshot = snapshot;
|
|
20280
20304
|
this.originalCode = snapshot.getText(0, snapshot.getLength());
|
|
20281
20305
|
if (!tsrx || typeof tsrx.compile_to_volar_mappings !== "function") {
|
|
20282
|
-
logError$
|
|
20306
|
+
logError$3("Invalid ripple compiler - missing compile_to_volar_mappings method");
|
|
20283
20307
|
throw new Error("Invalid ripple compiler");
|
|
20284
20308
|
}
|
|
20285
20309
|
this.update(snapshot);
|
|
@@ -20289,7 +20313,7 @@ var TSRXVirtualCode = class {
|
|
|
20289
20313
|
* @returns {void}
|
|
20290
20314
|
*/
|
|
20291
20315
|
update(snapshot) {
|
|
20292
|
-
log$
|
|
20316
|
+
log$7("Updating virtual code for:", this.fileName);
|
|
20293
20317
|
const newCode = snapshot.getText(0, snapshot.getLength());
|
|
20294
20318
|
const changeRange = snapshot.getChangeRange(this.sourceSnapshot);
|
|
20295
20319
|
this.sourceSnapshot = snapshot;
|
|
@@ -20301,46 +20325,46 @@ var TSRXVirtualCode = class {
|
|
|
20301
20325
|
let transpiled;
|
|
20302
20326
|
let isDotTyped = false;
|
|
20303
20327
|
let dotPosition = -1;
|
|
20304
|
-
log$
|
|
20328
|
+
log$7("changeRange:", JSON.stringify(changeRange));
|
|
20305
20329
|
if (changeRange) {
|
|
20306
20330
|
const changeStart = changeRange.span.start;
|
|
20307
20331
|
const changeEnd = changeStart + changeRange.span.length;
|
|
20308
20332
|
const newEnd = changeStart + changeRange.newLength;
|
|
20309
20333
|
const oldText = this.originalCode.substring(changeStart, changeEnd);
|
|
20310
20334
|
const newText = newCode.substring(changeStart, newEnd);
|
|
20311
|
-
log$
|
|
20312
|
-
log$
|
|
20313
|
-
log$
|
|
20314
|
-
log$
|
|
20335
|
+
log$7("Change details:");
|
|
20336
|
+
log$7(" Position:", changeStart, "-", changeEnd, "(length:", changeRange.span.length, ")");
|
|
20337
|
+
log$7(" Old text:", JSON.stringify(oldText));
|
|
20338
|
+
log$7(" New text:", JSON.stringify(newText), "(length:", changeRange.newLength, ")");
|
|
20315
20339
|
if (newText.endsWith(".")) {
|
|
20316
20340
|
const charBeforeDot = newEnd > 1 ? newCode[newEnd - 2] : "";
|
|
20317
|
-
log$
|
|
20341
|
+
log$7(" Char before dot:", JSON.stringify(charBeforeDot));
|
|
20318
20342
|
if (/[$#_\u200C\u200D\p{ID_Continue}\)\]\}]/u.test(charBeforeDot)) {
|
|
20319
20343
|
isDotTyped = true;
|
|
20320
20344
|
dotPosition = newEnd - 1;
|
|
20321
|
-
log$
|
|
20345
|
+
log$7("ChangeRange detected dot typed at position", dotPosition);
|
|
20322
20346
|
}
|
|
20323
20347
|
}
|
|
20324
20348
|
}
|
|
20325
20349
|
try {
|
|
20326
20350
|
if (isDotTyped && dotPosition >= 0) {
|
|
20327
20351
|
const codeWithoutDot = newCode.substring(0, dotPosition) + newCode.substring(dotPosition + 1);
|
|
20328
|
-
log$
|
|
20352
|
+
log$7("Compiling without typed dot at position", dotPosition);
|
|
20329
20353
|
transpiled = this.tsrx.compile_to_volar_mappings(codeWithoutDot, this.fileName, { loose: true });
|
|
20330
|
-
log$
|
|
20354
|
+
log$7("Compilation without dot successful");
|
|
20331
20355
|
if (transpiled && transpiled.code && transpiled.mappings.length > 0) {
|
|
20332
20356
|
const insertedDotPosition = restore_typed_dot_in_transpiled_code(transpiled, dotPosition);
|
|
20333
20357
|
if (insertedDotPosition === null) logWarning("Failed to restore typed dot into transpiled output");
|
|
20334
|
-
else log$
|
|
20358
|
+
else log$7("Inserted typed dot at generated position", insertedDotPosition);
|
|
20335
20359
|
}
|
|
20336
20360
|
} else {
|
|
20337
|
-
log$
|
|
20361
|
+
log$7("Compiling Ripple code...");
|
|
20338
20362
|
transpiled = this.tsrx.compile_to_volar_mappings(newCode, this.fileName, { loose: true });
|
|
20339
|
-
log$
|
|
20363
|
+
log$7("Compilation successful, generated code length:", transpiled?.code?.length || 0);
|
|
20340
20364
|
}
|
|
20341
20365
|
} catch (e) {
|
|
20342
20366
|
const error = e;
|
|
20343
|
-
logError$
|
|
20367
|
+
logError$3("Ripple compilation failed for", this.fileName, ":", error);
|
|
20344
20368
|
if (process.env.TSRX_TSC === "true") {
|
|
20345
20369
|
logTSRXErrors(this.fileName, [error]);
|
|
20346
20370
|
const fallback = getFallbackGeneratedCode(this.tsrx, newCode, this.fileName);
|
|
@@ -20374,10 +20398,10 @@ var TSRXVirtualCode = class {
|
|
|
20374
20398
|
if (process.env.TSRX_TSC === "true" && transpiled.errors.length > 0) logTSRXErrors(this.fileName, transpiled.errors);
|
|
20375
20399
|
const cssMappings = transpiled.cssMappings;
|
|
20376
20400
|
if (cssMappings.length > 0) {
|
|
20377
|
-
log$
|
|
20401
|
+
log$7("Creating", cssMappings.length, "CSS embedded codes");
|
|
20378
20402
|
this.embeddedCodes = cssMappings.map((mapping, index) => {
|
|
20379
20403
|
const cssContent = mapping.data?.customData?.content;
|
|
20380
|
-
log$
|
|
20404
|
+
log$7(`CSS region ${index}: \
|
|
20381
20405
|
offset ${mapping.sourceOffsets[0]}-${mapping.sourceOffsets[0] + mapping.lengths[0]}, \
|
|
20382
20406
|
length ${mapping.lengths[0]}`);
|
|
20383
20407
|
return {
|
|
@@ -20394,17 +20418,17 @@ var TSRXVirtualCode = class {
|
|
|
20394
20418
|
});
|
|
20395
20419
|
} else this.embeddedCodes = [];
|
|
20396
20420
|
if (DEBUG) {
|
|
20397
|
-
log$
|
|
20398
|
-
log$
|
|
20399
|
-
log$
|
|
20400
|
-
log$
|
|
20401
|
-
log$
|
|
20402
|
-
log$
|
|
20403
|
-
log$
|
|
20421
|
+
log$7("CSS embedded codes:", (this.embeddedCodes || []).length);
|
|
20422
|
+
log$7("Using transpiled code, mapping count:", this.mappings.length);
|
|
20423
|
+
log$7("Original code length:", newCode.length);
|
|
20424
|
+
log$7("Generated code length:", this.generatedCode.length);
|
|
20425
|
+
log$7("Last 100 chars of original:", JSON.stringify(newCode.slice(-100)));
|
|
20426
|
+
log$7("Last 200 chars of generated:", JSON.stringify(this.generatedCode.slice(-200)));
|
|
20427
|
+
log$7("Last few mappings:");
|
|
20404
20428
|
const startIdx = Math.max(0, this.mappings.length - 5);
|
|
20405
20429
|
for (let i = startIdx; i < this.mappings.length; i++) {
|
|
20406
20430
|
const m = this.mappings[i];
|
|
20407
|
-
log$
|
|
20431
|
+
log$7(` Mapping ${i}: source[${m.sourceOffsets[0]}:${m.sourceOffsets[0] + m.lengths[0]}] -> gen[${m.generatedOffsets[0]}:${m.generatedOffsets[0] + m.lengths[0]}], len=${m.lengths[0]}, completion=${m.data?.completion}`);
|
|
20408
20432
|
}
|
|
20409
20433
|
}
|
|
20410
20434
|
this.snapshot = {
|
|
@@ -20413,7 +20437,7 @@ var TSRXVirtualCode = class {
|
|
|
20413
20437
|
getChangeRange: () => void 0
|
|
20414
20438
|
};
|
|
20415
20439
|
} else {
|
|
20416
|
-
log$
|
|
20440
|
+
log$7("Compilation failed, only display where the compilation error occurred.");
|
|
20417
20441
|
this.originalCode = newCode;
|
|
20418
20442
|
this.generatedCode = newCode;
|
|
20419
20443
|
this.mappings = [{
|
|
@@ -20506,7 +20530,7 @@ function getFallbackGeneratedCode(tsrx, source, file_name) {
|
|
|
20506
20530
|
errors: result?.errors ?? []
|
|
20507
20531
|
};
|
|
20508
20532
|
} catch (error) {
|
|
20509
|
-
logError$
|
|
20533
|
+
logError$3("Fallback compilation failed for", file_name, ":", error);
|
|
20510
20534
|
}
|
|
20511
20535
|
}
|
|
20512
20536
|
/**
|
|
@@ -20525,7 +20549,7 @@ function extractCssFromSource(code) {
|
|
|
20525
20549
|
const cssContent = match[1];
|
|
20526
20550
|
const cssStart = match.index + (fullMatch.indexOf(">") + 1);
|
|
20527
20551
|
const cssLength = cssContent.length;
|
|
20528
|
-
log$
|
|
20552
|
+
log$7(`Extracted CSS region ${index}: offset ${cssStart}, length ${cssLength}`);
|
|
20529
20553
|
/** @type {CodeMapping} */
|
|
20530
20554
|
const mapping = {
|
|
20531
20555
|
sourceOffsets: [cssStart],
|
|
@@ -20558,7 +20582,7 @@ function extractCssFromSource(code) {
|
|
|
20558
20582
|
});
|
|
20559
20583
|
index++;
|
|
20560
20584
|
}
|
|
20561
|
-
if (embeddedCodes.length > 0) log$
|
|
20585
|
+
if (embeddedCodes.length > 0) log$7(`Extracted ${embeddedCodes.length} CSS embedded codes from style tags`);
|
|
20562
20586
|
return embeddedCodes;
|
|
20563
20587
|
}
|
|
20564
20588
|
/**
|
|
@@ -20739,7 +20763,7 @@ function find_workspace_compiler_entry_for_file(normalized_file_name, exists_syn
|
|
|
20739
20763
|
if (available_candidates.length > 0) {
|
|
20740
20764
|
const package_manifest = get_nearest_package_manifest(dir, exists_sync);
|
|
20741
20765
|
found_path = available_candidates.find(([compiler_name, , package_hints]) => package_manifest_matches_compiler(package_manifest, compiler_name, package_hints))?.[1] ?? available_candidates[0][1];
|
|
20742
|
-
log$
|
|
20766
|
+
log$7("Found tsrx compiler at:", found_path, "for extension:", ext);
|
|
20743
20767
|
}
|
|
20744
20768
|
compiler_path_map.set(cache_key, found_path);
|
|
20745
20769
|
}
|
|
@@ -20792,7 +20816,7 @@ function getCachedTypeDefinitionFile(typesFilePath) {
|
|
|
20792
20816
|
logWarning(`Types file does not exist at path: ${typesFilePath}`);
|
|
20793
20817
|
return;
|
|
20794
20818
|
}
|
|
20795
|
-
log$
|
|
20819
|
+
log$7(`Found ripple types at: ${typesFilePath}`);
|
|
20796
20820
|
const fileContent = fs.default.readFileSync(typesFilePath, "utf8");
|
|
20797
20821
|
if (!fileContent) {
|
|
20798
20822
|
logWarning(`Failed to read content of types file at: ${typesFilePath}`);
|
|
@@ -20827,8 +20851,9 @@ function get_compiler_dir_for_file(normalized_file_name) {
|
|
|
20827
20851
|
|
|
20828
20852
|
//#endregion
|
|
20829
20853
|
//#region src/definitionPlugin.js
|
|
20830
|
-
|
|
20831
|
-
|
|
20854
|
+
/** @import { LanguageServicePlugin, LocationLink } from '@volar/language-server'; */
|
|
20855
|
+
/** @import { DefinitionLocation } from '@tsrx/ripple'; */
|
|
20856
|
+
const { log: log$6 } = createLogging("[Ripple Definition Plugin]");
|
|
20832
20857
|
/** @type {string | undefined} */
|
|
20833
20858
|
let ripple_dir;
|
|
20834
20859
|
/**
|
|
@@ -20849,21 +20874,21 @@ function createDefinitionPlugin() {
|
|
|
20849
20874
|
}
|
|
20850
20875
|
const { virtualCode, sourceUri } = getVirtualCode(document, context);
|
|
20851
20876
|
if (virtualCode.languageId !== "ripple") {
|
|
20852
|
-
log$
|
|
20877
|
+
log$6(`Skipping definitions processing in the '${virtualCode.languageId}' context`);
|
|
20853
20878
|
return tsDefinitions;
|
|
20854
20879
|
}
|
|
20855
20880
|
const offset = document.offsetAt(position);
|
|
20856
20881
|
const { word, start, end } = getWordFromPosition(document.getText(), offset);
|
|
20857
20882
|
const customMapping = virtualCode.findMappingByGeneratedRange(start, end);
|
|
20858
|
-
log$
|
|
20859
|
-
log$
|
|
20883
|
+
log$6(`Cursor position in generated code for word '${word}':`, position);
|
|
20884
|
+
log$6(`Cursor offset in generated code for word '${word}':`, offset);
|
|
20860
20885
|
if (customMapping?.data.customData.definition !== false && customMapping?.data.customData.definition?.typeReplace) {
|
|
20861
20886
|
const { name: typeName, path: typePath } = customMapping.data.customData.definition.typeReplace;
|
|
20862
|
-
log$
|
|
20887
|
+
log$6(`Found replace definition for ${typeName}`);
|
|
20863
20888
|
const filePath = sourceUri.fsPath || sourceUri.path;
|
|
20864
20889
|
ripple_dir = ripple_dir ?? get_compiler_dir_for_file(normalizeFileNameOrUri(filePath));
|
|
20865
20890
|
if (!ripple_dir) {
|
|
20866
|
-
log$
|
|
20891
|
+
log$6(`Could not determine Ripple source directory for file: ${filePath}`);
|
|
20867
20892
|
return;
|
|
20868
20893
|
}
|
|
20869
20894
|
const typesFilePath = path.default.join(ripple_dir, ...typePath.split("/"));
|
|
@@ -20911,7 +20936,7 @@ function createDefinitionPlugin() {
|
|
|
20911
20936
|
end: originEnd
|
|
20912
20937
|
}
|
|
20913
20938
|
};
|
|
20914
|
-
log$
|
|
20939
|
+
log$6(`Created definition link to ${typesFilePath}:${line}:${character}`);
|
|
20915
20940
|
return [locationLink];
|
|
20916
20941
|
}
|
|
20917
20942
|
}
|
|
@@ -20922,16 +20947,16 @@ function createDefinitionPlugin() {
|
|
|
20922
20947
|
const embedMapping = embeddedCode.mappings[0];
|
|
20923
20948
|
const sourceStartOffset = embedMapping.sourceOffsets[0] + loc.start;
|
|
20924
20949
|
const sourceEndOffset = embedMapping.sourceOffsets[0] + loc.end;
|
|
20925
|
-
log$
|
|
20950
|
+
log$6("Source document offsets - start for matching css:", sourceStartOffset, "end:", sourceEndOffset);
|
|
20926
20951
|
const sourceDocument = TextDocument.create(sourceUri.toString(), "ripple", 0, virtualCode.originalCode);
|
|
20927
20952
|
const targetStart = sourceDocument.positionAt(sourceStartOffset);
|
|
20928
20953
|
const targetEnd = sourceDocument.positionAt(sourceEndOffset);
|
|
20929
|
-
log$
|
|
20954
|
+
log$6("Target positions in source - start:", targetStart, "end:", targetEnd);
|
|
20930
20955
|
const generatedStart = customMapping.generatedOffsets[0];
|
|
20931
20956
|
const generatedEnd = generatedStart + customMapping.generatedLengths[0];
|
|
20932
20957
|
const originStart = document.positionAt(generatedStart);
|
|
20933
20958
|
const originEnd = document.positionAt(generatedEnd);
|
|
20934
|
-
log$
|
|
20959
|
+
log$6("Origin positions - start:", originStart, "end:", originEnd);
|
|
20935
20960
|
/** @type {LocationLink} */
|
|
20936
20961
|
tsDefinitions.push({
|
|
20937
20962
|
targetUri: sourceUri.toString(),
|
|
@@ -20965,7 +20990,7 @@ LanguageServicePlugin,
|
|
|
20965
20990
|
LanguageServicePluginInstance,
|
|
20966
20991
|
MarkupContent,
|
|
20967
20992
|
} from '@volar/language-server'; */
|
|
20968
|
-
const { log: log$
|
|
20993
|
+
const { log: log$5, logError: logError$2 } = createLogging("[Ripple Hover Plugin]");
|
|
20969
20994
|
/**
|
|
20970
20995
|
* @returns {LanguageServicePlugin}
|
|
20971
20996
|
*/
|
|
@@ -20984,7 +21009,7 @@ function createHoverPlugin() {
|
|
|
20984
21009
|
instance.provideHover = void 0;
|
|
20985
21010
|
break;
|
|
20986
21011
|
}
|
|
20987
|
-
if (!originalProvideHover) logError$
|
|
21012
|
+
if (!originalProvideHover) logError$2("'typescript-semantic plugin' was not found or has no 'provideHover'. This plugin must be loaded after Volar's typescript-semantic plugin.");
|
|
20988
21013
|
return { async provideHover(document, position, token) {
|
|
20989
21014
|
let tsHover = null;
|
|
20990
21015
|
if (originalProvideHover) tsHover = await originalProvideHover.call(originalInstance, document, position, token);
|
|
@@ -21007,11 +21032,11 @@ function createHoverPlugin() {
|
|
|
21007
21032
|
const { word, start, end } = getWordFromPosition(document.getText(), offset);
|
|
21008
21033
|
starOffset = start;
|
|
21009
21034
|
endOffset = end;
|
|
21010
|
-
log$
|
|
21011
|
-
log$
|
|
21035
|
+
log$5(`Cursor position in generated code for word '${word}':`, position);
|
|
21036
|
+
log$5(`Cursor offset in generated code for word '${word}':`, offset);
|
|
21012
21037
|
}
|
|
21013
21038
|
if (virtualCode.languageId !== "ripple") {
|
|
21014
|
-
log$
|
|
21039
|
+
log$5(`Skipping hover processing in the '${virtualCode.languageId}' context`);
|
|
21015
21040
|
return tsHover;
|
|
21016
21041
|
}
|
|
21017
21042
|
const mapping = virtualCode.findMappingByGeneratedRange(starOffset, endOffset);
|
|
@@ -21024,7 +21049,7 @@ function createHoverPlugin() {
|
|
|
21024
21049
|
/** @type {MarkupContent} **/
|
|
21025
21050
|
tsHover.contents.value
|
|
21026
21051
|
);
|
|
21027
|
-
log$
|
|
21052
|
+
log$5("Modified hover contents using custom hover function");
|
|
21028
21053
|
}
|
|
21029
21054
|
return tsHover;
|
|
21030
21055
|
} else if (typeof customHover === "string") {
|
|
@@ -21033,7 +21058,7 @@ function createHoverPlugin() {
|
|
|
21033
21058
|
tsHover.contents.value,
|
|
21034
21059
|
customHover
|
|
21035
21060
|
) : customHover;
|
|
21036
|
-
log$
|
|
21061
|
+
log$5("Found custom hover data in mapping");
|
|
21037
21062
|
return {
|
|
21038
21063
|
contents: {
|
|
21039
21064
|
kind: "markdown",
|
|
@@ -21045,10 +21070,10 @@ function createHoverPlugin() {
|
|
|
21045
21070
|
}
|
|
21046
21071
|
};
|
|
21047
21072
|
} else if (customHover === false) {
|
|
21048
|
-
log$
|
|
21073
|
+
log$5(`Hover explicitly suppressed in mapping at range start: ${starOffset}, end: ${endOffset}`);
|
|
21049
21074
|
return null;
|
|
21050
21075
|
}
|
|
21051
|
-
log$
|
|
21076
|
+
log$5("Found mapping for hover at range", "start: ", starOffset, "end: ", endOffset);
|
|
21052
21077
|
return tsHover;
|
|
21053
21078
|
} };
|
|
21054
21079
|
}
|
|
@@ -21058,7 +21083,7 @@ function createHoverPlugin() {
|
|
|
21058
21083
|
//#endregion
|
|
21059
21084
|
//#region src/completionPlugin.js
|
|
21060
21085
|
/** @import { LanguageServicePlugin, TextEdit, CompletionItem } from '@volar/language-server'; */
|
|
21061
|
-
const { log: log$
|
|
21086
|
+
const { log: log$4 } = createLogging("[Ripple Completion Plugin]");
|
|
21062
21087
|
/**
|
|
21063
21088
|
* Snippets that require auto-import from 'ripple'
|
|
21064
21089
|
* @type {Array<{label: string, filterText: string, detail: string, documentation: string, insertText: string, importName: string | null}>}
|
|
@@ -21394,7 +21419,7 @@ function createCompletionPlugin() {
|
|
|
21394
21419
|
};
|
|
21395
21420
|
const { virtualCode } = getVirtualCode(document, context);
|
|
21396
21421
|
if (virtualCode && virtualCode.languageId !== "ripple") {
|
|
21397
|
-
log$
|
|
21422
|
+
log$4(`Skipping Ripple completions in the '${virtualCode.languageId}' context`);
|
|
21398
21423
|
return {
|
|
21399
21424
|
items: [],
|
|
21400
21425
|
isIncomplete: false
|
|
@@ -21409,7 +21434,7 @@ function createCompletionPlugin() {
|
|
|
21409
21434
|
});
|
|
21410
21435
|
/** @type {CompletionItem[]} */
|
|
21411
21436
|
const items = [];
|
|
21412
|
-
log$
|
|
21437
|
+
log$4("🔔 Completion triggered:", {
|
|
21413
21438
|
triggerKind: completionContext.triggerKind,
|
|
21414
21439
|
triggerKindName: completionContext.triggerKind === 1 ? "Invoked" : completionContext.triggerKind === 2 ? "TriggerCharacter" : completionContext.triggerKind === 3 ? "Incomplete" : "Unknown",
|
|
21415
21440
|
triggerCharacter: completionContext.triggerCharacter || "(none)",
|
|
@@ -21468,7 +21493,7 @@ function createCompletionPlugin() {
|
|
|
21468
21493
|
}
|
|
21469
21494
|
const wordMatch = line.match(/(\w+)$/);
|
|
21470
21495
|
const currentWord = wordMatch ? wordMatch[1] : "";
|
|
21471
|
-
log$
|
|
21496
|
+
log$4("Current word:", currentWord, "length:", currentWord.length);
|
|
21472
21497
|
items.push(...RIPPLE_SNIPPETS);
|
|
21473
21498
|
return {
|
|
21474
21499
|
items,
|
|
@@ -21483,7 +21508,7 @@ function createCompletionPlugin() {
|
|
|
21483
21508
|
//#endregion
|
|
21484
21509
|
//#region src/autoInsertPlugin.js
|
|
21485
21510
|
/** @import { LanguageServicePlugin } from '@volar/language-server' */
|
|
21486
|
-
const { log: log$
|
|
21511
|
+
const { log: log$3 } = createLogging("[Ripple Auto-Insert Plugin]");
|
|
21487
21512
|
/**
|
|
21488
21513
|
* List of HTML void/self-closing elements that don't need closing tags
|
|
21489
21514
|
* https://developer.mozilla.org/en-US/docs/Glossary/Void_element
|
|
@@ -21522,12 +21547,20 @@ function createAutoInsertPlugin() {
|
|
|
21522
21547
|
documentOnTypeFormattingProvider: { triggerCharacters: [">"] }
|
|
21523
21548
|
},
|
|
21524
21549
|
create(context) {
|
|
21525
|
-
return {
|
|
21550
|
+
return {
|
|
21551
|
+
/**
|
|
21552
|
+
* @param {import('vscode-languageserver-textdocument').TextDocument} document
|
|
21553
|
+
* @param {import('@volar/language-server').Position} position
|
|
21554
|
+
* @param {{ rangeOffset: number; rangeLength: number; text: string }} lastChange
|
|
21555
|
+
* @param {import('@volar/language-server').CancellationToken} _token
|
|
21556
|
+
* @returns {Promise<string | null>}
|
|
21557
|
+
*/
|
|
21558
|
+
async provideAutoInsertSnippet(document, position, lastChange, _token) {
|
|
21526
21559
|
if (!is_ripple_document(document.uri)) return null;
|
|
21527
21560
|
if (!lastChange.text.endsWith(">")) return null;
|
|
21528
21561
|
const { virtualCode } = getVirtualCode(document, context);
|
|
21529
21562
|
if (virtualCode.languageId !== "ripple") {
|
|
21530
|
-
log$
|
|
21563
|
+
log$3(`Skipping auto-insert processing in the '${virtualCode.languageId}' context`);
|
|
21531
21564
|
return null;
|
|
21532
21565
|
}
|
|
21533
21566
|
const offset = document.offsetAt(position);
|
|
@@ -21550,11 +21583,11 @@ function createAutoInsertPlugin() {
|
|
|
21550
21583
|
if (attempts === 3) break;
|
|
21551
21584
|
}
|
|
21552
21585
|
if (!found) {
|
|
21553
|
-
log$
|
|
21586
|
+
log$3(`No opening tag position found from source position ${sourceOffset}`);
|
|
21554
21587
|
return null;
|
|
21555
21588
|
}
|
|
21556
21589
|
const line = sourceCode.slice(i, sourceOffset + 1);
|
|
21557
|
-
log$
|
|
21590
|
+
log$3("Auto-insert triggered at:", {
|
|
21558
21591
|
selection: `${position.line}:${position.character}`,
|
|
21559
21592
|
line,
|
|
21560
21593
|
change: lastChange,
|
|
@@ -21562,13 +21595,13 @@ function createAutoInsertPlugin() {
|
|
|
21562
21595
|
});
|
|
21563
21596
|
const tagMatch = line.match(/<([@$\w][\w.-]*)[^>]*?(?<!\/)>$/);
|
|
21564
21597
|
if (!tagMatch) {
|
|
21565
|
-
log$
|
|
21598
|
+
log$3("No tag match found");
|
|
21566
21599
|
return null;
|
|
21567
21600
|
}
|
|
21568
21601
|
const tagName = tagMatch[1];
|
|
21569
|
-
log$
|
|
21602
|
+
log$3("Tag matched:", tagName);
|
|
21570
21603
|
if (VOID_ELEMENTS.has(tagName.toLowerCase())) {
|
|
21571
|
-
log$
|
|
21604
|
+
log$3("Void element, skipping auto-close:", tagName);
|
|
21572
21605
|
return null;
|
|
21573
21606
|
}
|
|
21574
21607
|
if (document.getText({
|
|
@@ -21578,11 +21611,11 @@ function createAutoInsertPlugin() {
|
|
|
21578
21611
|
character: position.character + 100
|
|
21579
21612
|
}
|
|
21580
21613
|
}).startsWith(`</${tagName}>`)) {
|
|
21581
|
-
log$
|
|
21614
|
+
log$3("Closing tag already exists, skipping");
|
|
21582
21615
|
return null;
|
|
21583
21616
|
}
|
|
21584
21617
|
const closingTag = `</${tagName}>`;
|
|
21585
|
-
log$
|
|
21618
|
+
log$3("Inserting closing tag:", closingTag);
|
|
21586
21619
|
return `$0${closingTag}`;
|
|
21587
21620
|
} };
|
|
21588
21621
|
}
|
|
@@ -21600,7 +21633,7 @@ Diagnostic,
|
|
|
21600
21633
|
} from '@volar/language-server';
|
|
21601
21634
|
@import {TextDocument} from 'vscode-languageserver-textdocument';
|
|
21602
21635
|
*/
|
|
21603
|
-
const { log: log$
|
|
21636
|
+
const { log: log$2, logError: logError$1 } = createLogging("[Ripple TypeScript Diagnostic Plugin]");
|
|
21604
21637
|
/**
|
|
21605
21638
|
* @param {Diagnostic} diagnostic
|
|
21606
21639
|
* @param {Diagnostic[]} items
|
|
@@ -21618,7 +21651,7 @@ function process$1(diagnostic, items) {
|
|
|
21618
21651
|
*/
|
|
21619
21652
|
function processDiagnostics(document, context, diagnostics) {
|
|
21620
21653
|
if (!diagnostics || diagnostics.length === 0) return diagnostics;
|
|
21621
|
-
log$
|
|
21654
|
+
log$2(`Filtering ${diagnostics.length} TypeScript diagnostics for ${document.uri}`);
|
|
21622
21655
|
const { virtualCode } = getVirtualCode(document, context);
|
|
21623
21656
|
if (!virtualCode || virtualCode.languageId !== "ripple") return diagnostics;
|
|
21624
21657
|
/** @type {Diagnostic[]} */
|
|
@@ -21640,12 +21673,12 @@ function processDiagnostics(document, context, diagnostics) {
|
|
|
21640
21673
|
}
|
|
21641
21674
|
const diagnosticCode = typeof diagnostic.code === "number" ? diagnostic.code : typeof diagnostic.code === "string" ? parseInt(diagnostic.code) : null;
|
|
21642
21675
|
if (diagnosticCode && suppressedCodes.includes(diagnosticCode)) {
|
|
21643
|
-
log$
|
|
21676
|
+
log$2(`Suppressing diagnostic ${diagnosticCode}: ${diagnostic.message}`);
|
|
21644
21677
|
continue;
|
|
21645
21678
|
}
|
|
21646
21679
|
process$1(diagnostic, result);
|
|
21647
21680
|
}
|
|
21648
|
-
log$
|
|
21681
|
+
log$2(`Filtered from ${diagnostics.length} to ${result.length} diagnostics`);
|
|
21649
21682
|
return result;
|
|
21650
21683
|
}
|
|
21651
21684
|
/**
|
|
@@ -21656,7 +21689,7 @@ function processDiagnostics(document, context, diagnostics) {
|
|
|
21656
21689
|
* @returns {LanguageServicePlugin}
|
|
21657
21690
|
*/
|
|
21658
21691
|
function createTypeScriptDiagnosticFilterPlugin() {
|
|
21659
|
-
log$
|
|
21692
|
+
log$2("Creating TypeScript diagnostic filter plugin...");
|
|
21660
21693
|
return {
|
|
21661
21694
|
name: "ripple-typescript-diagnostic-filter",
|
|
21662
21695
|
capabilities: {},
|
|
@@ -21671,10 +21704,10 @@ function createTypeScriptDiagnosticFilterPlugin() {
|
|
|
21671
21704
|
instance.provideDiagnostics = async function(document, token) {
|
|
21672
21705
|
return processDiagnostics(document, context, await originalProvider?.call(originalInstance, document, token) ?? []);
|
|
21673
21706
|
};
|
|
21674
|
-
log$
|
|
21707
|
+
log$2("Successfully wrapped typescript-semantic provideDiagnostics");
|
|
21675
21708
|
break;
|
|
21676
21709
|
}
|
|
21677
|
-
if (!originalProvider) logError("'typescript-semantic plugin' was not found or has no 'provideDiagnostics'. This plugin must be loaded after Volar's typescript-semantic plugin.");
|
|
21710
|
+
if (!originalProvider) logError$1("'typescript-semantic plugin' was not found or has no 'provideDiagnostics'. This plugin must be loaded after Volar's typescript-semantic plugin.");
|
|
21678
21711
|
return {};
|
|
21679
21712
|
}
|
|
21680
21713
|
};
|
|
@@ -21684,7 +21717,7 @@ function createTypeScriptDiagnosticFilterPlugin() {
|
|
|
21684
21717
|
//#region src/documentHighlightPlugin.js
|
|
21685
21718
|
/** @import { LanguageServicePlugin } from '@volar/language-server' */
|
|
21686
21719
|
/** @import { LanguageServicePluginInstance } from '@volar/language-server' */
|
|
21687
|
-
const { log } = createLogging("[Ripple Document Highlight Plugin]");
|
|
21720
|
+
const { log: log$1 } = createLogging("[Ripple Document Highlight Plugin]");
|
|
21688
21721
|
/**
|
|
21689
21722
|
* Document Highlight plugin for Ripple
|
|
21690
21723
|
* Provides word highlighting (grey background) for custom Ripple keywords like 'pending'
|
|
@@ -21705,14 +21738,14 @@ function createDocumentHighlightPlugin() {
|
|
|
21705
21738
|
instance.provideDocumentHighlights = void 0;
|
|
21706
21739
|
break;
|
|
21707
21740
|
}
|
|
21708
|
-
if (!originalProvideDocumentHighlights) log("'typescript-semantic plugin' was not found or has no 'provideDocumentHighlights'. Document highlights will be limited to custom Ripple keywords only.");
|
|
21741
|
+
if (!originalProvideDocumentHighlights) log$1("'typescript-semantic plugin' was not found or has no 'provideDocumentHighlights'. Document highlights will be limited to custom Ripple keywords only.");
|
|
21709
21742
|
return { async provideDocumentHighlights(document, position, token) {
|
|
21710
21743
|
if (!originalProvideDocumentHighlights) return null;
|
|
21711
21744
|
let tsHighlights = await originalProvideDocumentHighlights.call(originalInstance, document, position, token);
|
|
21712
21745
|
if (!tsHighlights || tsHighlights.length > 0) return tsHighlights;
|
|
21713
21746
|
const { virtualCode } = getVirtualCode(document, context);
|
|
21714
21747
|
if (virtualCode.languageId !== "ripple") {
|
|
21715
|
-
log(`Skipping highlight processing in the '${virtualCode.languageId}' context`);
|
|
21748
|
+
log$1(`Skipping highlight processing in the '${virtualCode.languageId}' context`);
|
|
21716
21749
|
return tsHighlights;
|
|
21717
21750
|
}
|
|
21718
21751
|
const offset = document.offsetAt(position);
|
|
@@ -21735,7 +21768,7 @@ function createDocumentHighlightPlugin() {
|
|
|
21735
21768
|
kind: mapping.data.customData.wordHighlight.kind
|
|
21736
21769
|
});
|
|
21737
21770
|
}
|
|
21738
|
-
if (tsHighlights.length > 0) log(`Found ${tsHighlights.length} occurrences of '${word}'`);
|
|
21771
|
+
if (tsHighlights.length > 0) log$1(`Found ${tsHighlights.length} occurrences of '${word}'`);
|
|
21739
21772
|
return [...tsHighlights];
|
|
21740
21773
|
} };
|
|
21741
21774
|
}
|
|
@@ -21777,6 +21810,110 @@ function createTypeScriptServices(ts) {
|
|
|
21777
21810
|
return create(ts);
|
|
21778
21811
|
}
|
|
21779
21812
|
|
|
21813
|
+
//#endregion
|
|
21814
|
+
//#region src/server.js
|
|
21815
|
+
/** @import {CompilerOptions} from 'typescript' */
|
|
21816
|
+
const { log, logError } = createLogging("[Ripple Language Server]");
|
|
21817
|
+
function createRippleLanguageServer() {
|
|
21818
|
+
const connection = (0, import_node.createConnection)();
|
|
21819
|
+
const server = (0, import_node.createServer)(connection);
|
|
21820
|
+
connection.listen();
|
|
21821
|
+
const rippleLanguagePlugin = getRippleLanguagePlugin();
|
|
21822
|
+
log("Language plugin instance created");
|
|
21823
|
+
/** @type {WeakSet<Function>} */
|
|
21824
|
+
const wrappedFunctions = /* @__PURE__ */ new WeakSet();
|
|
21825
|
+
/**
|
|
21826
|
+
* Ensure TypeScript hosts always see compiler options with Ripple defaults.
|
|
21827
|
+
* @param {unknown} target
|
|
21828
|
+
* @param {string} method
|
|
21829
|
+
*/
|
|
21830
|
+
function wrapCompilerOptionsProvider(target, method) {
|
|
21831
|
+
if (!target) return;
|
|
21832
|
+
const host = target;
|
|
21833
|
+
const original = host[method];
|
|
21834
|
+
if (typeof original !== "function" || wrappedFunctions.has(original)) return;
|
|
21835
|
+
/** @type {CompilerOptions | undefined} */
|
|
21836
|
+
let cachedInput;
|
|
21837
|
+
/** @type {CompilerOptions | undefined} */
|
|
21838
|
+
let cachedOutput;
|
|
21839
|
+
const wrapped = () => {
|
|
21840
|
+
/** @type {CompilerOptions} */
|
|
21841
|
+
const input = original.call(host);
|
|
21842
|
+
if (cachedInput !== input) {
|
|
21843
|
+
cachedInput = input;
|
|
21844
|
+
cachedOutput = resolveConfig({ options: input }).options;
|
|
21845
|
+
}
|
|
21846
|
+
return cachedOutput;
|
|
21847
|
+
};
|
|
21848
|
+
wrappedFunctions.add(original);
|
|
21849
|
+
wrappedFunctions.add(wrapped);
|
|
21850
|
+
host[method] = wrapped;
|
|
21851
|
+
}
|
|
21852
|
+
connection.onInitialize(async (params) => {
|
|
21853
|
+
try {
|
|
21854
|
+
log("Initializing Ripple language server...");
|
|
21855
|
+
log("Initialization options:", JSON.stringify(params.initializationOptions, null, 2));
|
|
21856
|
+
const ts = require("typescript");
|
|
21857
|
+
const initResult = server.initialize(params, (0, import_node.createTypeScriptProject)(ts, void 0, ({ projectHost }) => {
|
|
21858
|
+
wrapCompilerOptionsProvider(projectHost, "getCompilationSettings");
|
|
21859
|
+
return {
|
|
21860
|
+
languagePlugins: [rippleLanguagePlugin],
|
|
21861
|
+
setup({ project }) {
|
|
21862
|
+
wrapCompilerOptionsProvider(project?.typescript?.languageServiceHost, "getCompilationSettings");
|
|
21863
|
+
}
|
|
21864
|
+
};
|
|
21865
|
+
}), [
|
|
21866
|
+
createAutoInsertPlugin(),
|
|
21867
|
+
createCompletionPlugin(),
|
|
21868
|
+
createCompileErrorDiagnosticPlugin(),
|
|
21869
|
+
createDefinitionPlugin(),
|
|
21870
|
+
(0, volar_service_css.create)(),
|
|
21871
|
+
...createTypeScriptServices(ts),
|
|
21872
|
+
createTypeScriptDiagnosticFilterPlugin(),
|
|
21873
|
+
createHoverPlugin(),
|
|
21874
|
+
createDocumentHighlightPlugin()
|
|
21875
|
+
]);
|
|
21876
|
+
log("Server initialization complete");
|
|
21877
|
+
return initResult;
|
|
21878
|
+
} catch (initError) {
|
|
21879
|
+
logError("Server initialization failed:", initError);
|
|
21880
|
+
throw initError;
|
|
21881
|
+
}
|
|
21882
|
+
});
|
|
21883
|
+
connection.onInitialized(async () => {
|
|
21884
|
+
log("Server initialized.");
|
|
21885
|
+
server.initialized();
|
|
21886
|
+
try {
|
|
21887
|
+
await server.fileWatcher.watchFiles([
|
|
21888
|
+
"**/*.ts",
|
|
21889
|
+
"**/*.tsx",
|
|
21890
|
+
"**/*.cts",
|
|
21891
|
+
"**/*.mts",
|
|
21892
|
+
"**/*.js",
|
|
21893
|
+
"**/*.jsx",
|
|
21894
|
+
"**/*.cjs",
|
|
21895
|
+
"**/*.mjs",
|
|
21896
|
+
"**/*.d.ts",
|
|
21897
|
+
"**/tsconfig.json",
|
|
21898
|
+
"**/jsconfig.json"
|
|
21899
|
+
]);
|
|
21900
|
+
log("File watchers registered for TypeScript/JavaScript files.");
|
|
21901
|
+
} catch (err) {
|
|
21902
|
+
logError("Failed to register file watchers:", err);
|
|
21903
|
+
}
|
|
21904
|
+
});
|
|
21905
|
+
process.on("uncaughtException", (err) => {
|
|
21906
|
+
logError("Uncaught exception:", err);
|
|
21907
|
+
});
|
|
21908
|
+
process.on("unhandledRejection", (reason, promise) => {
|
|
21909
|
+
logError("Unhandled rejection at:", promise, "reason:", reason);
|
|
21910
|
+
});
|
|
21911
|
+
return {
|
|
21912
|
+
connection,
|
|
21913
|
+
server
|
|
21914
|
+
};
|
|
21915
|
+
}
|
|
21916
|
+
|
|
21780
21917
|
//#endregion
|
|
21781
21918
|
Object.defineProperty(exports, '__toCommonJS', {
|
|
21782
21919
|
enumerable: true,
|
|
@@ -21784,82 +21921,10 @@ Object.defineProperty(exports, '__toCommonJS', {
|
|
|
21784
21921
|
return __toCommonJS;
|
|
21785
21922
|
}
|
|
21786
21923
|
});
|
|
21787
|
-
Object.defineProperty(exports, '
|
|
21788
|
-
enumerable: true,
|
|
21789
|
-
get: function () {
|
|
21790
|
-
return __toESM;
|
|
21791
|
-
}
|
|
21792
|
-
});
|
|
21793
|
-
Object.defineProperty(exports, 'createAutoInsertPlugin', {
|
|
21794
|
-
enumerable: true,
|
|
21795
|
-
get: function () {
|
|
21796
|
-
return createAutoInsertPlugin;
|
|
21797
|
-
}
|
|
21798
|
-
});
|
|
21799
|
-
Object.defineProperty(exports, 'createCompileErrorDiagnosticPlugin', {
|
|
21800
|
-
enumerable: true,
|
|
21801
|
-
get: function () {
|
|
21802
|
-
return createCompileErrorDiagnosticPlugin;
|
|
21803
|
-
}
|
|
21804
|
-
});
|
|
21805
|
-
Object.defineProperty(exports, 'createCompletionPlugin', {
|
|
21806
|
-
enumerable: true,
|
|
21807
|
-
get: function () {
|
|
21808
|
-
return createCompletionPlugin;
|
|
21809
|
-
}
|
|
21810
|
-
});
|
|
21811
|
-
Object.defineProperty(exports, 'createDefinitionPlugin', {
|
|
21812
|
-
enumerable: true,
|
|
21813
|
-
get: function () {
|
|
21814
|
-
return createDefinitionPlugin;
|
|
21815
|
-
}
|
|
21816
|
-
});
|
|
21817
|
-
Object.defineProperty(exports, 'createDocumentHighlightPlugin', {
|
|
21818
|
-
enumerable: true,
|
|
21819
|
-
get: function () {
|
|
21820
|
-
return createDocumentHighlightPlugin;
|
|
21821
|
-
}
|
|
21822
|
-
});
|
|
21823
|
-
Object.defineProperty(exports, 'createHoverPlugin', {
|
|
21824
|
-
enumerable: true,
|
|
21825
|
-
get: function () {
|
|
21826
|
-
return createHoverPlugin;
|
|
21827
|
-
}
|
|
21828
|
-
});
|
|
21829
|
-
Object.defineProperty(exports, 'createLogging', {
|
|
21830
|
-
enumerable: true,
|
|
21831
|
-
get: function () {
|
|
21832
|
-
return createLogging;
|
|
21833
|
-
}
|
|
21834
|
-
});
|
|
21835
|
-
Object.defineProperty(exports, 'createTypeScriptDiagnosticFilterPlugin', {
|
|
21836
|
-
enumerable: true,
|
|
21837
|
-
get: function () {
|
|
21838
|
-
return createTypeScriptDiagnosticFilterPlugin;
|
|
21839
|
-
}
|
|
21840
|
-
});
|
|
21841
|
-
Object.defineProperty(exports, 'createTypeScriptServices', {
|
|
21842
|
-
enumerable: true,
|
|
21843
|
-
get: function () {
|
|
21844
|
-
return createTypeScriptServices;
|
|
21845
|
-
}
|
|
21846
|
-
});
|
|
21847
|
-
Object.defineProperty(exports, 'getRippleLanguagePlugin', {
|
|
21848
|
-
enumerable: true,
|
|
21849
|
-
get: function () {
|
|
21850
|
-
return getRippleLanguagePlugin;
|
|
21851
|
-
}
|
|
21852
|
-
});
|
|
21853
|
-
Object.defineProperty(exports, 'require_node', {
|
|
21854
|
-
enumerable: true,
|
|
21855
|
-
get: function () {
|
|
21856
|
-
return require_node;
|
|
21857
|
-
}
|
|
21858
|
-
});
|
|
21859
|
-
Object.defineProperty(exports, 'resolveConfig', {
|
|
21924
|
+
Object.defineProperty(exports, 'createRippleLanguageServer', {
|
|
21860
21925
|
enumerable: true,
|
|
21861
21926
|
get: function () {
|
|
21862
|
-
return
|
|
21927
|
+
return createRippleLanguageServer;
|
|
21863
21928
|
}
|
|
21864
21929
|
});
|
|
21865
|
-
//# sourceMappingURL=
|
|
21930
|
+
//# sourceMappingURL=server-BvQFo7aV.js.map
|