@volar/typescript 1.7.4 → 1.7.6

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/getProgram.js CHANGED
@@ -85,11 +85,11 @@ function getProgram(ts, core, ls, lsHost) {
85
85
  if (sourceSnapshot !== source.snapshot)
86
86
  continue;
87
87
  for (const start of map.toSourceOffsets(diagnostic.start)) {
88
- const reportStart = typeof start[1].data.diagnostic === 'object' ? typeof start[1].data.diagnostic.shouldReport() : !!start[1].data.diagnostic;
88
+ const reportStart = typeof start[1].data.diagnostic === 'object' ? start[1].data.diagnostic.shouldReport() : !!start[1].data.diagnostic;
89
89
  if (!reportStart)
90
90
  continue;
91
91
  for (const end of map.toSourceOffsets(diagnostic.start + diagnostic.length, true)) {
92
- const reportEnd = typeof end[1].data.diagnostic === 'object' ? typeof end[1].data.diagnostic.shouldReport() : !!end[1].data.diagnostic;
92
+ const reportEnd = typeof end[1].data.diagnostic === 'object' ? end[1].data.diagnostic.shouldReport() : !!end[1].data.diagnostic;
93
93
  if (!reportEnd)
94
94
  continue;
95
95
  onMapping(diagnostic, source.fileName, start[0], end[0], source.snapshot.getText(0, source.snapshot.getLength()));
@@ -93,7 +93,6 @@ function createLanguageService(core, ts, sys) {
93
93
  : mode === 'typeDefinition' ? ls.getTypeDefinitionAtPosition(fileName, position)
94
94
  : mode === 'references' ? ls.getReferencesAtPosition(fileName, position)
95
95
  : mode === 'implementation' ? ls.getImplementationAtPosition(fileName, position)
96
- // @ts-expect-error
97
96
  : mode === 'rename' && preferences ? ls.findRenameLocations(fileName, position, findInStrings, findInComments, preferences)
98
97
  : undefined;
99
98
  if (!_symbols)
package/out/sys.js CHANGED
@@ -47,6 +47,10 @@ function createSys(ctx, ts, env, dtsHost) {
47
47
  newLine: sys?.newLine ?? '\n',
48
48
  useCaseSensitiveFileNames: sys?.useCaseSensitiveFileNames ?? false,
49
49
  realpath: sys?.realpath,
50
+ write: sys?.write ?? (() => { }),
51
+ writeFile: sys?.writeFile ?? (() => { }),
52
+ createDirectory: sys?.createDirectory ?? (() => { }),
53
+ exit: sys?.exit ?? (() => { }),
50
54
  getExecutingFilePath: sys?.getExecutingFilePath ?? (() => rootPath + '/__fake__.js'),
51
55
  getCurrentDirectory: () => rootPath,
52
56
  getModifiedTime,
@@ -62,11 +66,6 @@ function createSys(ctx, ts, env, dtsHost) {
62
66
  }
63
67
  return version;
64
68
  },
65
- // ignore
66
- write: () => { },
67
- writeFile: () => { },
68
- createDirectory: () => { },
69
- exit: () => { },
70
69
  };
71
70
  function resolvePath(fsPath) {
72
71
  if (sys) {
@@ -274,6 +273,8 @@ function createSys(ctx, ts, env, dtsHost) {
274
273
  }
275
274
  }
276
275
  function onReadDirectoryResult(dir, result) {
276
+ // See https://github.com/microsoft/TypeScript/blob/e1a9290051a3b0cbdfbadc3adbcc155a4641522a/src/compiler/sys.ts#L1853-L1857
277
+ result = result.filter(([name]) => name !== '.' && name !== '..');
277
278
  let updated = false;
278
279
  for (const [name, fileType] of result) {
279
280
  if (fileType === 1 || fileType === 64) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volar/typescript",
3
- "version": "1.7.4",
3
+ "version": "1.7.6",
4
4
  "main": "out/index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -13,10 +13,10 @@
13
13
  "directory": "packages/typescript"
14
14
  },
15
15
  "dependencies": {
16
- "@volar/language-core": "1.7.4"
16
+ "@volar/language-core": "1.7.6"
17
17
  },
18
18
  "devDependencies": {
19
- "@volar/language-service": "1.7.4"
19
+ "@volar/language-service": "1.7.6"
20
20
  },
21
- "gitHead": "65ed950a3440d8abd6d189cea6ff48c0e23a6384"
21
+ "gitHead": "b2dbe05318c06658ae97a65f9bc6d1badc55a81b"
22
22
  }