|
2 | 2 | // Licensed under the MIT License. |
3 | 3 |
|
4 | 4 | import { injectable } from 'inversify'; |
5 | | -import { CancellationToken, Event, FileSystemWatcher, GlobPattern, Uri, workspace, WorkspaceConfiguration, WorkspaceFolder, WorkspaceFoldersChangeEvent } from 'vscode'; |
| 5 | +import * as vscode from 'vscode'; |
6 | 6 | import { IWorkspaceService } from './types'; |
7 | 7 |
|
8 | 8 | @injectable() |
9 | 9 | export class WorkspaceService implements IWorkspaceService { |
10 | | - public get onDidChangeConfiguration(): Event<void> { |
11 | | - return workspace.onDidChangeConfiguration; |
| 10 | + public get onDidChangeConfiguration(): vscode.Event<void> { |
| 11 | + return vscode.workspace.onDidChangeConfiguration; |
12 | 12 | } |
13 | 13 | public get rootPath(): string | undefined { |
14 | | - return workspace.rootPath; |
| 14 | + return vscode.workspace.rootPath; |
15 | 15 | } |
16 | | - public get workspaceFolders(): WorkspaceFolder[] | undefined { |
17 | | - return workspace.workspaceFolders; |
| 16 | + public get workspaceFolders(): vscode.WorkspaceFolder[] | undefined { |
| 17 | + return vscode.workspace.workspaceFolders; |
18 | 18 | } |
19 | | - public get onDidChangeWorkspaceFolders(): Event<WorkspaceFoldersChangeEvent> { |
20 | | - return workspace.onDidChangeWorkspaceFolders; |
| 19 | + public get onDidChangeWorkspaceFolders(): vscode.Event<vscode.WorkspaceFoldersChangeEvent> { |
| 20 | + return vscode.workspace.onDidChangeWorkspaceFolders; |
21 | 21 | } |
22 | | - public getConfiguration(section?: string, resource?: Uri): WorkspaceConfiguration { |
23 | | - return workspace.getConfiguration(section, resource); |
| 22 | + public getConfiguration(section?: string, resource?: vscode.Uri): vscode.WorkspaceConfiguration { |
| 23 | + return vscode.workspace.getConfiguration(section, resource); |
24 | 24 | } |
25 | | - public getWorkspaceFolder(uri: Uri): WorkspaceFolder | undefined { |
26 | | - return workspace.getWorkspaceFolder(uri); |
| 25 | + public getWorkspaceFolder(uri: vscode.Uri): vscode.WorkspaceFolder | undefined { |
| 26 | + return vscode.workspace.getWorkspaceFolder(uri); |
27 | 27 | } |
28 | | - public asRelativePath(pathOrUri: string | Uri, includeWorkspaceFolder?: boolean): string { |
29 | | - return workspace.asRelativePath(pathOrUri, includeWorkspaceFolder); |
| 28 | + public asRelativePath(pathOrUri: string | vscode.Uri, includeWorkspaceFolder?: boolean): string { |
| 29 | + return vscode.workspace.asRelativePath(pathOrUri, includeWorkspaceFolder); |
30 | 30 | } |
31 | | - public createFileSystemWatcher(globPattern: GlobPattern, ignoreCreateEvents?: boolean, ignoreChangeEvents?: boolean, ignoreDeleteEvents?: boolean): FileSystemWatcher { |
32 | | - return workspace.createFileSystemWatcher(globPattern, ignoreChangeEvents, ignoreChangeEvents, ignoreDeleteEvents); |
| 31 | + public createFileSystemWatcher(globPattern: vscode.GlobPattern, ignoreCreateEvents?: boolean, ignoreChangeEvents?: boolean, ignoreDeleteEvents?: boolean): vscode.FileSystemWatcher { |
| 32 | + return vscode.workspace.createFileSystemWatcher(globPattern, ignoreChangeEvents, ignoreChangeEvents, ignoreDeleteEvents); |
33 | 33 | } |
34 | | - public findFiles(include: GlobPattern, exclude?: GlobPattern, maxResults?: number, token?: CancellationToken): Thenable<Uri[]> { |
35 | | - return workspace.findFiles(include, exclude, maxResults, token); |
| 34 | + public findFiles(include: vscode.GlobPattern, exclude?: vscode.GlobPattern, maxResults?: number, token?: vscode.CancellationToken): Thenable<vscode.Uri[]> { |
| 35 | + return vscode.workspace.findFiles(include, exclude, maxResults, token); |
36 | 36 | } |
37 | 37 | } |
0 commit comments