Skip to content

resolve workspace.root deprecation warning #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions src/actions/utils/openFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,11 @@ const openFiles = async (files: string[]) => {
}
for (const filePath of files) {
try {
// TODO figure out why this does not work
// try {
// const absoluteFilePath = join(workspaceRoot.uri.path, filePath)
// const doc = await vscode.workspace.openTextDocument(absoluteFilePath)
// await vscode.window.showTextDocument(doc, vscode.ViewColumn.One)
// // there are times when initialization leave the panel behind any files opened
// // ensure the panel is redrawn on the right side first
// // webview.createOrShow()
// } catch (error) {
// console.log(`Failed to open file ${filePath}`, error)
// }
const wr = vscode.workspace.rootPath
if (!wr) {
throw new Error('No workspace root path')
const workspaceFolders: vscode.WorkspaceFolder[] | undefined = vscode.workspace.workspaceFolders
if (!workspaceFolders || !workspaceFolders.length) {
throw new Error('No workspace directory. Open a workspace directory and try again')
}
const wr: string = workspaceFolders[0].uri.path
const absoluteFilePath = join(wr, filePath)
const doc = await vscode.workspace.openTextDocument(absoluteFilePath)
await vscode.window.showTextDocument(doc, vscode.ViewColumn.One)
Expand Down