mirror of
https://github.com/microsoft/vscode.git
synced 2026-03-03 23:39:31 +00:00
setup uri properly and also make the doc more clear, fixes #4315
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
import * as vscode from 'vscode';
|
||||
import {ITypescriptServiceClient} from '../typescriptService';
|
||||
import {loadMessageBundle} from 'vscode-nls';
|
||||
import {dirname} from 'path';
|
||||
import {dirname, join} from 'path';
|
||||
|
||||
const localize = loadMessageBundle();
|
||||
const selector = ['javascript', 'javascriptreact'];
|
||||
@@ -88,7 +88,7 @@ export function create(client: ITypescriptServiceClient, memento: vscode.Memento
|
||||
projectHinted[configFileName] = true;
|
||||
item.hide();
|
||||
|
||||
return vscode.workspace.openTextDocument(vscode.Uri.parse('untitled://' + vscode.workspace.rootPath + '/jsconfig.json'))
|
||||
return vscode.workspace.openTextDocument(vscode.Uri.parse('untitled:' + join(vscode.workspace.rootPath, 'jsconfig.json')))
|
||||
.then(vscode.window.showTextDocument)
|
||||
.then(editor => editor.edit(builder => builder.insert(new vscode.Position(0, 0), defaultConfig)));
|
||||
}
|
||||
|
||||
4
src/vs/vscode.d.ts
vendored
4
src/vs/vscode.d.ts
vendored
@@ -3213,8 +3213,8 @@ declare namespace vscode {
|
||||
* [open document](#workspace.onDidOpenTextDocument)-event fires.
|
||||
* The document to open is denoted by the [uri](#Uri). Two schemes are supported:
|
||||
*
|
||||
* file: A file on disk, will be rejected if the file does not exist or cannot be loaded, e.g. 'file:///Users/frodo/r.ini'.
|
||||
* untitled: A new file that should be saved on disk, e.g. 'untitled:/Users/frodo/new.js'. The language will be derived from the file name.
|
||||
* file: A file on disk, will be rejected if the file does not exist or cannot be loaded, e.g. `file:///Users/frodo/r.ini`.
|
||||
* untitled: A new file that should be saved on disk, e.g. `untitled:c:\frodo\new.js`. The language will be derived from the file name.
|
||||
*
|
||||
* Uris with other schemes will make this method return a rejected promise.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user