@marko/language-server 1.0.7 → 1.0.9

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/index.js CHANGED
@@ -1166,6 +1166,10 @@ var import_path6 = __toESM(require("path"));
1166
1166
  var import_language_tools13 = require("@marko/language-tools");
1167
1167
  var fsPathReg = /^(?:[./\\]|[A-Z]:)/i;
1168
1168
  var modulePartsReg = /^((?:@(?:[^/]+)\/)?(?:[^/]+))(.*)$/;
1169
+ import_language_tools13.Project.setDefaultTypePaths({
1170
+ internalTypesFile: import_path6.default.join(__dirname, "marko.internal.d.ts"),
1171
+ markoTypesFile: import_path6.default.join(__dirname, "marko.runtime.d.ts")
1172
+ });
1169
1173
  function patch(ts2, configFile, extractCache2, resolutionCache, host, ps) {
1170
1174
  var _a, _b, _c;
1171
1175
  const processors = import_language_tools13.Processors.create({
@@ -1177,6 +1181,17 @@ function patch(ts2, configFile, extractCache2, resolutionCache, host, ps) {
1177
1181
  var _a2;
1178
1182
  return (_a2 = processor.getRootNames) == null ? void 0 : _a2.call(processor);
1179
1183
  }).flat().filter(Boolean);
1184
+ const trackFile = ps ? (fileName) => {
1185
+ ps.getOrCreateScriptInfoForNormalizedPath(
1186
+ fileName,
1187
+ true,
1188
+ void 0,
1189
+ ts2.ScriptKind.Deferred,
1190
+ false,
1191
+ host
1192
+ );
1193
+ } : () => {
1194
+ };
1180
1195
  const getScriptFileNames = host.getScriptFileNames.bind(host);
1181
1196
  host.getScriptFileNames = () => [
1182
1197
  ...new Set(rootNames.concat(getScriptFileNames()))
@@ -1203,14 +1218,7 @@ function patch(ts2, configFile, extractCache2, resolutionCache, host, ps) {
1203
1218
  } catch {
1204
1219
  cached = { snapshot: ts2.ScriptSnapshot.fromString("") };
1205
1220
  }
1206
- ps == null ? void 0 : ps.getOrCreateScriptInfoForNormalizedPath(
1207
- fileName,
1208
- false,
1209
- void 0,
1210
- ts2.ScriptKind.Deferred,
1211
- false,
1212
- host
1213
- );
1221
+ trackFile(fileName);
1214
1222
  extractCache2.set(fileName, cached);
1215
1223
  }
1216
1224
  return cached.snapshot;
@@ -1244,7 +1252,8 @@ function patch(ts2, configFile, extractCache2, resolutionCache, host, ps) {
1244
1252
  let normalModuleLiterals = moduleLiterals;
1245
1253
  let resolvedModules;
1246
1254
  for (let i = 0; i < moduleLiterals.length; i++) {
1247
- const moduleName = moduleLiterals[i].text;
1255
+ const moduleLiteral = moduleLiterals[i];
1256
+ const moduleName = moduleLiteral.text;
1248
1257
  const processor = moduleName[0] !== "*" ? getProcessor(moduleName) : void 0;
1249
1258
  if (processor) {
1250
1259
  let resolvedFileName;
@@ -1302,6 +1311,7 @@ function patch(ts2, configFile, extractCache2, resolutionCache, host, ps) {
1302
1311
  });
1303
1312
  } else if (resolvedModules) {
1304
1313
  resolvedModules.push(void 0);
1314
+ normalModuleLiterals.push(moduleLiteral);
1305
1315
  }
1306
1316
  }
1307
1317
  const normalResolvedModules = normalModuleLiterals.length ? resolveModuleNameLiterals(