forked from microsoft/vscode-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocumentManager.ts
More file actions
80 lines (77 loc) · 3.1 KB
/
documentManager.ts
File metadata and controls
80 lines (77 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import { injectable } from 'inversify';
import {
DecorationRenderOptions,
Event,
TextDocument,
TextDocumentChangeEvent,
TextDocumentShowOptions,
TextEditor,
TextEditorDecorationType,
TextEditorOptionsChangeEvent,
TextEditorSelectionChangeEvent,
TextEditorViewColumnChangeEvent,
Uri,
ViewColumn,
window,
workspace,
WorkspaceEdit,
} from 'vscode';
import { IDocumentManager } from './types';
@injectable()
export class DocumentManager implements IDocumentManager {
public get textDocuments(): readonly TextDocument[] {
return workspace.textDocuments;
}
public get activeTextEditor(): TextEditor | undefined {
return window.activeTextEditor;
}
public get visibleTextEditors(): TextEditor[] {
return window.visibleTextEditors;
}
public get onDidChangeActiveTextEditor(): Event<TextEditor | undefined> {
return window.onDidChangeActiveTextEditor;
}
public get onDidChangeTextDocument(): Event<TextDocumentChangeEvent> {
return workspace.onDidChangeTextDocument;
}
public get onDidChangeVisibleTextEditors(): Event<TextEditor[]> {
return window.onDidChangeVisibleTextEditors;
}
public get onDidChangeTextEditorSelection(): Event<TextEditorSelectionChangeEvent> {
return window.onDidChangeTextEditorSelection;
}
public get onDidChangeTextEditorOptions(): Event<TextEditorOptionsChangeEvent> {
return window.onDidChangeTextEditorOptions;
}
public get onDidChangeTextEditorViewColumn(): Event<TextEditorViewColumnChangeEvent> {
return window.onDidChangeTextEditorViewColumn;
}
public get onDidOpenTextDocument(): Event<TextDocument> {
return workspace.onDidOpenTextDocument;
}
public get onDidCloseTextDocument(): Event<TextDocument> {
return workspace.onDidCloseTextDocument;
}
public get onDidSaveTextDocument(): Event<TextDocument> {
return workspace.onDidSaveTextDocument;
}
public showTextDocument(document: TextDocument, column?: ViewColumn, preserveFocus?: boolean): Thenable<TextEditor>;
public showTextDocument(document: TextDocument | Uri, options?: TextDocumentShowOptions): Thenable<TextEditor>;
public showTextDocument(uri: any, options?: any, preserveFocus?: any): Thenable<TextEditor> {
return window.showTextDocument(uri, options, preserveFocus);
}
public openTextDocument(uri: Uri): Thenable<TextDocument>;
public openTextDocument(fileName: string): Thenable<TextDocument>;
public openTextDocument(options?: { language?: string; content?: string }): Thenable<TextDocument>;
public openTextDocument(arg?: any): Thenable<TextDocument> {
return workspace.openTextDocument(arg);
}
public applyEdit(edit: WorkspaceEdit): Thenable<boolean> {
return workspace.applyEdit(edit);
}
public createTextEditorDecorationType(options: DecorationRenderOptions): TextEditorDecorationType {
return window.createTextEditorDecorationType(options);
}
}