Skip to content

Commit acbddf2

Browse files
committed
Fix formatting bug
1 parent 75340d8 commit acbddf2

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

server/src/documentProvider.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ class Document implements ITextDocument {
2929

3030
readonly uri: string;
3131
readonly version: number = 0;
32-
readonly lineCount: number = 0;
3332

3433
constructor(uri: string, init: { inMemoryDoc: ITextDocument });
3534
constructor(uri: string, init: { onDiskDoc: ITextDocument });
@@ -96,6 +95,18 @@ class Document implements ITextDocument {
9695
setOnDiskDoc(doc: TextDocument | undefined) {
9796
this.onDiskDoc = doc;
9897
}
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+
}
99110
}
100111

101112
export class DocumentProvider {

0 commit comments

Comments
 (0)