@volar/language-core 2.0.0-alpha.4 → 2.0.0-alpha.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.
@@ -23,7 +23,7 @@ function createFileProvider(languages, caseSensitive, sync) {
23
23
  value.snapshot = snapshot;
24
24
  if (value.virtualFile) {
25
25
  disposeVirtualFiles(value);
26
- value.virtualFile[1].updateVirtualFile(value.virtualFile[0], snapshot);
26
+ value.virtualFile[1].updateVirtualFile(value.virtualFile[0], snapshot, this);
27
27
  updateVirtualFiles(value);
28
28
  }
29
29
  return value;
@@ -34,7 +34,7 @@ function createFileProvider(languages, caseSensitive, sync) {
34
34
  }
35
35
  }
36
36
  for (const language of languages) {
37
- const virtualFile = language.createVirtualFile(fileName, languageId, snapshot);
37
+ const virtualFile = language.createVirtualFile(fileName, languageId, snapshot, this);
38
38
  if (virtualFile) {
39
39
  // created
40
40
  const source = {
@@ -56,7 +56,7 @@ function createFileProvider(languages, caseSensitive, sync) {
56
56
  const value = sourceFileRegistry.get(fileName);
57
57
  if (value) {
58
58
  if (value.virtualFile) {
59
- value.virtualFile[1].disposeVirtualFile?.(value.virtualFile[0]);
59
+ value.virtualFile[1].disposeVirtualFile?.(value.virtualFile[0], this);
60
60
  }
61
61
  sourceFileRegistry.delete(fileName); // deleted
62
62
  disposeVirtualFiles(value);
package/lib/types.d.ts CHANGED
@@ -44,9 +44,9 @@ export interface BaseFile {
44
44
  snapshot: ts.IScriptSnapshot;
45
45
  }
46
46
  export interface LanguagePlugin<T extends VirtualFile = VirtualFile> {
47
- createVirtualFile(id: string, languageId: string, snapshot: ts.IScriptSnapshot): T | undefined;
48
- updateVirtualFile(virtualFile: T, snapshot: ts.IScriptSnapshot): void;
49
- disposeVirtualFile?(virtualFile: T): void;
47
+ createVirtualFile(id: string, languageId: string, snapshot: ts.IScriptSnapshot, files: FileProvider): T | undefined;
48
+ updateVirtualFile(virtualFile: T, snapshot: ts.IScriptSnapshot, files: FileProvider): void;
49
+ disposeVirtualFile?(virtualFile: T, files: FileProvider): void;
50
50
  typescript?: {
51
51
  resolveSourceFileName(tsFileName: string): string | undefined;
52
52
  resolveModuleName?(path: string, impliedNodeFormat?: ts.ResolutionMode): string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volar/language-core",
3
- "version": "2.0.0-alpha.4",
3
+ "version": "2.0.0-alpha.6",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -12,7 +12,7 @@
12
12
  "directory": "packages/language-core"
13
13
  },
14
14
  "dependencies": {
15
- "@volar/source-map": "2.0.0-alpha.4"
15
+ "@volar/source-map": "2.0.0-alpha.6"
16
16
  },
17
- "gitHead": "4d07249613d0cc5de4197e90c741a64adf92b84b"
17
+ "gitHead": "e81e8f70e54967242922891b7e825a5e40b56459"
18
18
  }