@astrojs/language-server 0.11.0 → 0.12.0

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.
Files changed (98) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/bin/browserServer.js +3 -0
  3. package/bin/nodeServer.js +3 -0
  4. package/dist/browser.d.ts +1 -0
  5. package/dist/browser.js +8 -0
  6. package/dist/check.js +2 -5
  7. package/dist/core/DiagnosticsManager.d.ts +3 -3
  8. package/dist/core/DiagnosticsManager.js +2 -2
  9. package/dist/core/config/ConfigManager.d.ts +19 -164
  10. package/dist/core/config/ConfigManager.js +62 -101
  11. package/dist/core/config/index.d.ts +1 -0
  12. package/dist/core/config/index.js +1 -0
  13. package/dist/core/config/interfaces.d.ts +123 -0
  14. package/dist/core/config/interfaces.js +2 -0
  15. package/dist/core/documents/AstroDocument.d.ts +18 -0
  16. package/dist/core/documents/AstroDocument.js +37 -0
  17. package/dist/core/documents/DocumentBase.d.ts +10 -2
  18. package/dist/core/documents/DocumentBase.js +15 -50
  19. package/dist/core/documents/DocumentManager.d.ts +12 -16
  20. package/dist/core/documents/DocumentManager.js +32 -26
  21. package/dist/core/documents/DocumentMapper.js +3 -1
  22. package/dist/core/documents/index.d.ts +1 -1
  23. package/dist/core/documents/index.js +1 -1
  24. package/dist/core/documents/parseAstro.d.ts +2 -2
  25. package/dist/core/documents/parseHtml.d.ts +2 -2
  26. package/dist/core/documents/parseHtml.js +4 -1
  27. package/dist/core/documents/utils.d.ts +22 -26
  28. package/dist/core/documents/utils.js +96 -134
  29. package/dist/index.d.ts +0 -1
  30. package/dist/index.js +1 -3
  31. package/dist/node.d.ts +1 -0
  32. package/dist/node.js +29 -0
  33. package/dist/plugins/PluginHost.d.ts +8 -9
  34. package/dist/plugins/PluginHost.js +22 -36
  35. package/dist/plugins/astro/AstroPlugin.d.ts +11 -12
  36. package/dist/plugins/astro/AstroPlugin.js +17 -42
  37. package/dist/plugins/astro/features/{CompletionProvider.d.ts → CompletionsProvider.d.ts} +5 -5
  38. package/dist/plugins/astro/features/{CompletionProvider.js → CompletionsProvider.js} +33 -58
  39. package/dist/plugins/css/CSSDocument.d.ts +3 -3
  40. package/dist/plugins/css/CSSDocument.js +7 -16
  41. package/dist/plugins/css/CSSPlugin.d.ts +19 -11
  42. package/dist/plugins/css/CSSPlugin.js +63 -41
  43. package/dist/plugins/css/StyleAttributeDocument.d.ts +2 -2
  44. package/dist/plugins/css/StyleAttributeDocument.js +2 -2
  45. package/dist/plugins/css/features/astro-selectors.d.ts +2 -0
  46. package/dist/plugins/css/features/astro-selectors.js +16 -0
  47. package/dist/plugins/css/features/{getIdClassCompletion.d.ts → getIdClassCompletions.d.ts} +3 -3
  48. package/dist/plugins/css/features/{getIdClassCompletion.js → getIdClassCompletions.js} +10 -9
  49. package/dist/plugins/css/{service.d.ts → language-service.d.ts} +0 -0
  50. package/dist/plugins/css/{service.js → language-service.js} +2 -1
  51. package/dist/plugins/html/HTMLPlugin.d.ts +15 -17
  52. package/dist/plugins/html/HTMLPlugin.js +33 -41
  53. package/dist/plugins/index.d.ts +2 -2
  54. package/dist/plugins/index.js +2 -2
  55. package/dist/plugins/interfaces.d.ts +35 -48
  56. package/dist/plugins/typescript/LanguageServiceManager.d.ts +33 -14
  57. package/dist/plugins/typescript/LanguageServiceManager.js +57 -32
  58. package/dist/plugins/typescript/TypeScriptPlugin.d.ts +16 -23
  59. package/dist/plugins/typescript/TypeScriptPlugin.js +43 -55
  60. package/dist/plugins/typescript/astro-sys.d.ts +5 -3
  61. package/dist/plugins/typescript/astro-sys.js +24 -45
  62. package/dist/plugins/typescript/features/CompletionsProvider.d.ts +6 -6
  63. package/dist/plugins/typescript/features/CompletionsProvider.js +17 -37
  64. package/dist/plugins/typescript/features/DiagnosticsProvider.d.ts +4 -4
  65. package/dist/plugins/typescript/features/DiagnosticsProvider.js +22 -61
  66. package/dist/plugins/typescript/features/HoverProvider.d.ts +4 -5
  67. package/dist/plugins/typescript/features/HoverProvider.js +9 -10
  68. package/dist/plugins/typescript/features/SignatureHelpProvider.d.ts +4 -5
  69. package/dist/plugins/typescript/features/SignatureHelpProvider.js +15 -11
  70. package/dist/plugins/typescript/features/utils.d.ts +1 -12
  71. package/dist/plugins/typescript/features/utils.js +2 -22
  72. package/dist/plugins/typescript/language-service.d.ts +38 -0
  73. package/dist/plugins/typescript/language-service.js +227 -0
  74. package/dist/plugins/typescript/module-loader.d.ts +5 -8
  75. package/dist/plugins/typescript/module-loader.js +43 -23
  76. package/dist/plugins/typescript/snapshots/DocumentSnapshot.d.ts +90 -0
  77. package/dist/plugins/typescript/snapshots/DocumentSnapshot.js +135 -0
  78. package/dist/plugins/typescript/snapshots/SnapshotManager.d.ts +42 -0
  79. package/dist/plugins/typescript/snapshots/SnapshotManager.js +197 -0
  80. package/dist/plugins/typescript/snapshots/utils.d.ts +28 -0
  81. package/dist/plugins/typescript/snapshots/utils.js +84 -0
  82. package/dist/plugins/typescript/utils.d.ts +8 -12
  83. package/dist/plugins/typescript/utils.js +105 -158
  84. package/dist/server.d.ts +2 -4
  85. package/dist/server.js +88 -54
  86. package/dist/utils.d.ts +16 -8
  87. package/dist/utils.js +29 -14
  88. package/package.json +18 -12
  89. package/bin/server.js +0 -7
  90. package/dist/core/documents/Document.d.ts +0 -51
  91. package/dist/core/documents/Document.js +0 -135
  92. package/dist/plugins/typescript/DocumentSnapshot.d.ts +0 -99
  93. package/dist/plugins/typescript/DocumentSnapshot.js +0 -259
  94. package/dist/plugins/typescript/SnapshotManager.d.ts +0 -24
  95. package/dist/plugins/typescript/SnapshotManager.js +0 -103
  96. package/dist/plugins/typescript/languageService.d.ts +0 -17
  97. package/dist/plugins/typescript/languageService.js +0 -173
  98. package/types/index.d.ts +0 -4
package/dist/utils.js CHANGED
@@ -1,12 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.debounceThrottle = exports.debounceSameArg = exports.isBeforeOrEqualToPosition = exports.isInRange = exports.isNotNullOrUndefined = exports.clamp = exports.flatten = exports.isPossibleClientComponent = exports.isPossibleComponent = exports.pathToUrl = exports.urlToPath = exports.normalizeUri = void 0;
3
+ exports.debounceThrottle = exports.debounceSameArg = exports.isBeforeOrEqualToPosition = exports.isInRange = exports.isNotNullOrUndefined = exports.clamp = exports.flatten = exports.isPossibleClientComponent = exports.isPossibleComponent = exports.getLastPartOfPath = exports.pathToUrl = exports.urlToPath = exports.normalizePath = exports.normalizeUri = void 0;
4
4
  const vscode_uri_1 = require("vscode-uri");
5
5
  /** Normalizes a document URI */
6
6
  function normalizeUri(uri) {
7
7
  return vscode_uri_1.URI.parse(uri).toString();
8
8
  }
9
9
  exports.normalizeUri = normalizeUri;
10
+ /**
11
+ * Some paths (on windows) start with a upper case driver letter, some don't.
12
+ * This is normalized here.
13
+ */
14
+ function normalizePath(path) {
15
+ return vscode_uri_1.URI.file(path).fsPath.replace(/\\/g, '/');
16
+ }
17
+ exports.normalizePath = normalizePath;
10
18
  /** Turns a URL into a normalized FS Path */
11
19
  function urlToPath(stringUrl) {
12
20
  const url = vscode_uri_1.URI.parse(stringUrl);
@@ -21,6 +29,14 @@ function pathToUrl(path) {
21
29
  return vscode_uri_1.URI.file(path).toString();
22
30
  }
23
31
  exports.pathToUrl = pathToUrl;
32
+ /**
33
+ * Given a path like foo/bar or foo/bar.astro , returns its last path
34
+ * (bar or bar.astro in this example).
35
+ */
36
+ function getLastPartOfPath(path) {
37
+ return path.replace(/\\/g, '/').split('/').pop() || '';
38
+ }
39
+ exports.getLastPartOfPath = getLastPartOfPath;
24
40
  /**
25
41
  *
26
42
  * The language service is case insensitive, and would provide
@@ -63,14 +79,13 @@ function isNotNullOrUndefined(val) {
63
79
  return val !== undefined && val !== null;
64
80
  }
65
81
  exports.isNotNullOrUndefined = isNotNullOrUndefined;
66
- /** Checks if a position is inside range */
67
- function isInRange(positionToTest, range) {
82
+ function isInRange(range, positionToTest) {
68
83
  return isBeforeOrEqualToPosition(range.end, positionToTest) && isBeforeOrEqualToPosition(positionToTest, range.start);
69
84
  }
70
85
  exports.isInRange = isInRange;
71
- /** */
72
86
  function isBeforeOrEqualToPosition(position, positionToTest) {
73
- return positionToTest.line < position.line || (positionToTest.line === position.line && positionToTest.character <= position.character);
87
+ return (positionToTest.line < position.line ||
88
+ (positionToTest.line === position.line && positionToTest.character <= position.character));
74
89
  }
75
90
  exports.isBeforeOrEqualToPosition = isBeforeOrEqualToPosition;
76
91
  /**
@@ -79,9 +94,9 @@ exports.isBeforeOrEqualToPosition = isBeforeOrEqualToPosition;
79
94
  *
80
95
  * @param fn The function with it's argument
81
96
  * @param determineIfSame The function which determines if the previous invocation should be canceld or not
82
- * @param miliseconds Number of miliseconds to debounce
97
+ * @param milliseconds Number of miliseconds to debounce
83
98
  */
84
- function debounceSameArg(fn, shouldCancelPrevious, miliseconds) {
99
+ function debounceSameArg(fn, shouldCancelPrevious, milliseconds) {
85
100
  let timeout;
86
101
  let prevArg;
87
102
  return (arg) => {
@@ -92,31 +107,31 @@ function debounceSameArg(fn, shouldCancelPrevious, miliseconds) {
92
107
  timeout = setTimeout(() => {
93
108
  fn(arg);
94
109
  prevArg = undefined;
95
- }, miliseconds);
110
+ }, milliseconds);
96
111
  };
97
112
  }
98
113
  exports.debounceSameArg = debounceSameArg;
99
114
  /**
100
- * Debounces a function but also waits at minimum the specified number of miliseconds until
115
+ * Debounces a function but also waits at minimum the specified number of milliseconds until
101
116
  * the next invocation. This avoids needless calls when a synchronous call (like diagnostics)
102
117
  * took too long and the whole timeout of the next call was eaten up already.
103
118
  *
104
119
  * @param fn The function with it's argument
105
- * @param miliseconds Number of miliseconds to debounce/throttle
120
+ * @param milliseconds Number of milliseconds to debounce/throttle
106
121
  */
107
- function debounceThrottle(fn, miliseconds) {
122
+ function debounceThrottle(fn, milliseconds) {
108
123
  let timeout;
109
- let lastInvocation = Date.now() - miliseconds;
124
+ let lastInvocation = Date.now() - milliseconds;
110
125
  function maybeCall(...args) {
111
126
  clearTimeout(timeout);
112
127
  timeout = setTimeout(() => {
113
- if (Date.now() - lastInvocation < miliseconds) {
128
+ if (Date.now() - lastInvocation < milliseconds) {
114
129
  maybeCall(...args);
115
130
  return;
116
131
  }
117
132
  fn(...args);
118
133
  lastInvocation = Date.now();
119
- }, miliseconds);
134
+ }, milliseconds);
120
135
  }
121
136
  return maybeCall;
122
137
  }
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@astrojs/language-server",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "author": "withastro",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
7
7
  "main": "dist/index.js",
8
8
  "bin": {
9
- "astro-ls": "./bin/server.js"
9
+ "astro-ls": "./bin/nodeServer.js"
10
10
  },
11
11
  "files": [
12
12
  "dist",
@@ -16,27 +16,33 @@
16
16
  "scripts": {
17
17
  "build": "tsc",
18
18
  "dev": "astro-scripts dev \"src/**/*.ts\"",
19
- "test": "tap --no-coverage test/**"
19
+ "test": "cross-env TS_NODE_TRANSPILE_ONLY=true mocha --require ts-node/register \"test/**/*.ts\" --exclude \"test/**/*.d.ts\""
20
20
  },
21
21
  "dependencies": {
22
22
  "@astrojs/svelte-language-integration": "^0.1.0",
23
+ "@vscode/emmet-helper": "^2.8.4",
23
24
  "lodash": "^4.17.21",
24
25
  "source-map": "^0.7.3",
25
- "ts-morph": "^12.0.0",
26
- "typescript": "^4.5.4",
27
- "vscode-css-languageservice": "^5.1.1",
28
- "@vscode/emmet-helper": "^2.8.4",
29
- "vscode-html-languageservice": "^3.0.3",
30
- "vscode-languageserver": "6.1.1",
26
+ "typescript": "~4.6.2",
27
+ "vscode-css-languageservice": "^5.1.13",
28
+ "vscode-html-languageservice": "^4.2.2",
29
+ "vscode-languageserver": "7.0.0",
31
30
  "vscode-languageserver-protocol": "^3.16.0",
32
31
  "vscode-languageserver-textdocument": "^1.0.1",
33
32
  "vscode-languageserver-types": "^3.16.0",
34
33
  "vscode-uri": "^3.0.2"
35
34
  },
36
35
  "devDependencies": {
37
- "@types/lodash": "^4.14.116",
38
- "astro": "^0.23.5",
36
+ "@types/chai": "^4.3.0",
37
+ "@types/lodash": "^4.14.179",
38
+ "@types/mocha": "^9.1.0",
39
+ "@types/sinon": "^10.0.11",
40
+ "astro": "^0.23.7",
39
41
  "astro-scripts": "0.0.1",
40
- "tap": "^15.0.9"
42
+ "chai": "^4.3.6",
43
+ "cross-env": "^7.0.3",
44
+ "mocha": "^9.2.2",
45
+ "sinon": "^13.0.1",
46
+ "ts-node": "^10.7.0"
41
47
  }
42
48
  }
package/bin/server.js DELETED
@@ -1,7 +0,0 @@
1
- #! /usr/bin/env node
2
-
3
- // @ts-ignore
4
- // eslint-disable-next-line @typescript-eslint/no-var-requires
5
- const { startServer } = require('@astrojs/language-server/dist/index.js');
6
-
7
- startServer();
@@ -1,51 +0,0 @@
1
- import type { TagInformation } from './utils';
2
- import { Position } from 'vscode-languageserver';
3
- import { TextDocument } from 'vscode-languageserver-textdocument';
4
- import { HTMLDocument } from 'vscode-html-languageservice';
5
- import { AstroDocument } from './parseAstro';
6
- export declare class Document implements TextDocument {
7
- uri: string;
8
- private content;
9
- languageId: string;
10
- version: number;
11
- html: HTMLDocument;
12
- astro: AstroDocument;
13
- styleInfo: TagInformation | null;
14
- constructor(uri: string, text: string);
15
- private updateDocInfo;
16
- setText(text: string): void;
17
- /**
18
- * Update the text between two positions.
19
- * @param text The new text slice
20
- * @param start Start offset of the new text
21
- * @param end End offset of the new text
22
- */
23
- update(text: string, start: number, end: number): void;
24
- getText(): string;
25
- /**
26
- * Get the line and character based on the offset
27
- * @param offset The index of the position
28
- */
29
- positionAt(offset: number): Position;
30
- /**
31
- * Get the index of the line and character position
32
- * @param position Line and character position
33
- */
34
- offsetAt(position: Position): number;
35
- getLineUntilOffset(offset: number): string;
36
- private getLineOffsets;
37
- /**
38
- * Get the length of the document's content
39
- */
40
- getTextLength(): number;
41
- /**
42
- * Returns the file path if the url scheme is file
43
- */
44
- getFilePath(): string | null;
45
- /**
46
- * Get URL file path.
47
- */
48
- getURL(): string;
49
- get lines(): string[];
50
- get lineCount(): number;
51
- }
@@ -1,135 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Document = void 0;
4
- const vscode_languageserver_1 = require("vscode-languageserver");
5
- const utils_1 = require("../../utils");
6
- const parseHtml_1 = require("./parseHtml");
7
- const parseAstro_1 = require("./parseAstro");
8
- const utils_2 = require("./utils");
9
- class Document {
10
- constructor(uri, text) {
11
- this.uri = uri;
12
- this.languageId = 'astro';
13
- this.version = 0;
14
- this.styleInfo = null;
15
- this.content = text;
16
- this.updateDocInfo();
17
- }
18
- updateDocInfo() {
19
- this.html = (0, parseHtml_1.parseHtml)(this.content);
20
- this.astro = (0, parseAstro_1.parseAstro)(this.content);
21
- this.styleInfo = (0, utils_2.extractStyleTag)(this.content, this.html);
22
- if (this.styleInfo) {
23
- this.styleInfo.attributes.lang = 'css';
24
- }
25
- }
26
- setText(text) {
27
- this.content = text;
28
- this.version++;
29
- this.updateDocInfo();
30
- }
31
- /**
32
- * Update the text between two positions.
33
- * @param text The new text slice
34
- * @param start Start offset of the new text
35
- * @param end End offset of the new text
36
- */
37
- update(text, start, end) {
38
- const content = this.getText();
39
- this.setText(content.slice(0, start) + text + content.slice(end));
40
- }
41
- getText() {
42
- return this.content;
43
- }
44
- /**
45
- * Get the line and character based on the offset
46
- * @param offset The index of the position
47
- */
48
- positionAt(offset) {
49
- offset = (0, utils_1.clamp)(offset, 0, this.getTextLength());
50
- const lineOffsets = this.getLineOffsets();
51
- let low = 0;
52
- let high = lineOffsets.length;
53
- if (high === 0) {
54
- return vscode_languageserver_1.Position.create(0, offset);
55
- }
56
- while (low < high) {
57
- const mid = Math.floor((low + high) / 2);
58
- if (lineOffsets[mid] > offset) {
59
- high = mid;
60
- }
61
- else {
62
- low = mid + 1;
63
- }
64
- }
65
- // low is the least x for which the line offset is larger than the current offset
66
- // or array.length if no line offset is larger than the current offset
67
- const line = low - 1;
68
- return vscode_languageserver_1.Position.create(line, offset - lineOffsets[line]);
69
- }
70
- /**
71
- * Get the index of the line and character position
72
- * @param position Line and character position
73
- */
74
- offsetAt(position) {
75
- const lineOffsets = this.getLineOffsets();
76
- if (position.line >= lineOffsets.length) {
77
- return this.getTextLength();
78
- }
79
- else if (position.line < 0) {
80
- return 0;
81
- }
82
- const lineOffset = lineOffsets[position.line];
83
- const nextLineOffset = position.line + 1 < lineOffsets.length ? lineOffsets[position.line + 1] : this.getTextLength();
84
- return (0, utils_1.clamp)(nextLineOffset, lineOffset, lineOffset + position.character);
85
- }
86
- getLineUntilOffset(offset) {
87
- const { line, character } = this.positionAt(offset);
88
- return this.lines[line].slice(0, character);
89
- }
90
- getLineOffsets() {
91
- const lineOffsets = [];
92
- const text = this.getText();
93
- let isLineStart = true;
94
- for (let i = 0; i < text.length; i++) {
95
- if (isLineStart) {
96
- lineOffsets.push(i);
97
- isLineStart = false;
98
- }
99
- const ch = text.charAt(i);
100
- isLineStart = ch === '\r' || ch === '\n';
101
- if (ch === '\r' && i + 1 < text.length && text.charAt(i + 1) === '\n') {
102
- i++;
103
- }
104
- }
105
- if (isLineStart && text.length > 0) {
106
- lineOffsets.push(text.length);
107
- }
108
- return lineOffsets;
109
- }
110
- /**
111
- * Get the length of the document's content
112
- */
113
- getTextLength() {
114
- return this.getText().length;
115
- }
116
- /**
117
- * Returns the file path if the url scheme is file
118
- */
119
- getFilePath() {
120
- return (0, utils_1.urlToPath)(this.uri);
121
- }
122
- /**
123
- * Get URL file path.
124
- */
125
- getURL() {
126
- return this.uri;
127
- }
128
- get lines() {
129
- return this.getText().split(/\r?\n/);
130
- }
131
- get lineCount() {
132
- return this.lines.length;
133
- }
134
- }
135
- exports.Document = Document;
@@ -1,99 +0,0 @@
1
- import * as ts from 'typescript';
2
- import { TextDocumentContentChangeEvent, Position, Range } from 'vscode-languageserver';
3
- import { Document, DocumentMapper, IdentityMapper } from '../../core/documents';
4
- /**
5
- * The mapper to get from original snapshot positions to generated and vice versa.
6
- */
7
- export interface SnapshotFragment extends DocumentMapper {
8
- positionAt(offset: number): Position;
9
- offsetAt(position: Position): number;
10
- }
11
- /**
12
- * An error which occured while trying to parse/preprocess the Astro file contents.
13
- */
14
- export interface ParserError {
15
- message: string;
16
- range: Range;
17
- code: number;
18
- }
19
- export interface DocumentSnapshot extends ts.IScriptSnapshot {
20
- version: number;
21
- filePath: string;
22
- scriptKind: ts.ScriptKind;
23
- parserError: ParserError | null;
24
- positionAt(offset: number): Position;
25
- /**
26
- * Instantiates a source mapper.
27
- * `destroyFragment` needs to be called when
28
- * it's no longer needed / the class should be cleaned up
29
- * in order to prevent memory leaks.
30
- */
31
- getFragment(): Promise<DocumentFragmentSnapshot>;
32
- /**
33
- * Needs to be called when source mapper
34
- * is no longer needed / the class should be cleaned up
35
- * in order to prevent memory leaks.
36
- */
37
- destroyFragment(): void;
38
- /**
39
- * Convenience function for getText(0, getLength())
40
- */
41
- getFullText(): string;
42
- createFragment(mapper: IdentityMapper): DocumentFragmentSnapshot;
43
- toTSX(code: string, filePath: string): string;
44
- }
45
- export declare abstract class DocumentFragmentSnapshot implements Omit<DocumentSnapshot, 'createFragment' | 'getFragment' | 'destroyFragment' | 'toTSX'>, SnapshotFragment {
46
- private mapper;
47
- private parent;
48
- version: number;
49
- filePath: string;
50
- url: string;
51
- text: string;
52
- parserError: null;
53
- scriptKind: ts.ScriptKind;
54
- scriptInfo: null;
55
- constructor(mapper: any, parent: Document, toTSX: (code: string, filePath: string) => string);
56
- abstract toVirtualFilePath(filePath: string): string;
57
- getText(start: number, end: number): string;
58
- getLength(): number;
59
- getFullText(): string;
60
- getChangeRange(): undefined;
61
- positionAt(offset: number): import("vscode-html-languageservice").Position;
62
- getLineContainingOffset(offset: number): string;
63
- offsetAt(position: Position): number;
64
- getOriginalPosition(pos: Position): Position;
65
- getGeneratedPosition(pos: Position): Position;
66
- isInGenerated(pos: Position): boolean;
67
- getURL(): string;
68
- }
69
- declare class FrameworkDocumentFragmentSnapshot extends DocumentFragmentSnapshot {
70
- toVirtualFilePath(filePath: string): string;
71
- }
72
- export declare class AstroDocumentFragmentSnapshot extends DocumentFragmentSnapshot {
73
- toVirtualFilePath(filePath: string): string;
74
- }
75
- export declare class TypeScriptDocumentSnapshot implements DocumentSnapshot {
76
- version: number;
77
- readonly filePath: string;
78
- private text;
79
- scriptKind: ts.ScriptKind;
80
- scriptInfo: null;
81
- parserError: null;
82
- url: string;
83
- constructor(version: number, filePath: string, text: string);
84
- toTSX(): any;
85
- createFragment(): any;
86
- destroyFragment(): void;
87
- getText(start: number, end: number): string;
88
- getLength(): number;
89
- getFullText(): string;
90
- getChangeRange(): undefined;
91
- positionAt(offset: number): import("vscode-html-languageservice").Position;
92
- offsetAt(position: Position): number;
93
- getFragment(): Promise<FrameworkDocumentFragmentSnapshot>;
94
- getOriginalPosition(pos: Position): Position;
95
- getLineContainingOffset(offset: number): string;
96
- update(changes: TextDocumentContentChangeEvent[]): void;
97
- }
98
- export declare const createDocumentSnapshot: (filePath: string, currentText: string | null, createDocument?: ((_filePath: string, text: string, overrideText: boolean) => Document) | undefined) => DocumentSnapshot;
99
- export {};