There was an error while loading. Please reload this page.
1 parent 75340d8 commit acbddf2Copy full SHA for acbddf2
1 file changed
server/src/documentProvider.ts
@@ -29,7 +29,6 @@ class Document implements ITextDocument {
29
30
readonly uri: string;
31
readonly version: number = 0;
32
- readonly lineCount: number = 0;
33
34
constructor(uri: string, init: { inMemoryDoc: ITextDocument });
35
constructor(uri: string, init: { onDiskDoc: ITextDocument });
@@ -96,6 +95,18 @@ class Document implements ITextDocument {
96
95
setOnDiskDoc(doc: TextDocument | undefined) {
97
this.onDiskDoc = doc;
98
}
+
99
+ get lineCount(): number {
100
+ if (this.inMemoryDoc) {
101
+ return this.inMemoryDoc.lineCount;
102
+ }
103
104
+ if (this.onDiskDoc) {
105
+ return this.onDiskDoc.lineCount;
106
107
108
+ throw new Error("Document has been closed");
109
110
111
112
export class DocumentProvider {
0 commit comments