Skip to content
Snippets Groups Projects
Commit fd36c3fb authored by 最萌小汐's avatar 最萌小汐
Browse files

support single file mode

parent 26e0f763
No related branches found
No related tags found
No related merge requests found
...@@ -107,14 +107,14 @@ function activate(context) { ...@@ -107,14 +107,14 @@ function activate(context) {
return; return;
} }
let uri = document.uri; let uri = document.uri;
let folder = vscode_1.workspace.getWorkspaceFolder(uri);
// Untitled files go to a default client. // Untitled files go to a default client.
if (uri.scheme === 'untitled' && !defaultClient) { if (folder == null && vscode_1.workspace.workspaceFolders == null && !defaultClient) {
defaultClient = start(context, [ defaultClient = start(context, [
{ scheme: 'untitled', language: 'lua' } { scheme: 'file', language: 'lua' }
], null); ], null);
return; return;
} }
let folder = vscode_1.workspace.getWorkspaceFolder(uri);
// Files outside a folder can't be handled. This might depend on the language. // Files outside a folder can't be handled. This might depend on the language.
// Single file languages like JSON might handle files outside the workspace folders. // Single file languages like JSON might handle files outside the workspace folders.
if (!folder) { if (!folder) {
......
...@@ -160,15 +160,15 @@ export function activate(context: ExtensionContext) { ...@@ -160,15 +160,15 @@ export function activate(context: ExtensionContext) {
} }
let uri = document.uri; let uri = document.uri;
let folder = Workspace.getWorkspaceFolder(uri);
// Untitled files go to a default client. // Untitled files go to a default client.
if (uri.scheme === 'untitled' && !defaultClient) { if (folder == null && Workspace.workspaceFolders == null && !defaultClient) {
defaultClient = start(context, [ defaultClient = start(context, [
{ scheme: 'untitled', language: 'lua' } { scheme: 'file', language: 'lua' }
], null); ], null);
return; return;
} }
let folder = Workspace.getWorkspaceFolder(uri);
// Files outside a folder can't be handled. This might depend on the language. // Files outside a folder can't be handled. This might depend on the language.
// Single file languages like JSON might handle files outside the workspace folders. // Single file languages like JSON might handle files outside the workspace folders.
if (!folder) { if (!folder) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment