diff --git a/vscode/bus/src/callbacks.ts b/vscode/bus/src/callbacks.ts index 0601fd892a..82d8231add 100644 --- a/vscode/bus/src/callbacks.ts +++ b/vscode/bus/src/callbacks.ts @@ -4,7 +4,7 @@ export type CallbackShape = Record export type Callback = { openFile: { - uri: string + filePath: string } rpcResponse: RPCResponse } & CallbackShape diff --git a/vscode/extension/src/commands/tableDiff.ts b/vscode/extension/src/commands/tableDiff.ts index d9587d261b..78dbb549c8 100644 --- a/vscode/extension/src/commands/tableDiff.ts +++ b/vscode/extension/src/commands/tableDiff.ts @@ -271,7 +271,7 @@ export function showTableDiff( if (workspaceFolders.length != 1) { throw new Error('Only one workspace folder is supported') } - const fullPath = vscode.Uri.parse(message.payload.uri) + const fullPath = vscode.Uri.file(message.payload.filePath) const document = await vscode.workspace.openTextDocument(fullPath) await vscode.window.showTextDocument(document) break diff --git a/vscode/extension/src/webviews/lineagePanel.ts b/vscode/extension/src/webviews/lineagePanel.ts index 0fd0be9c2a..a3c307d204 100644 --- a/vscode/extension/src/webviews/lineagePanel.ts +++ b/vscode/extension/src/webviews/lineagePanel.ts @@ -47,7 +47,7 @@ export class LineagePanel implements WebviewViewProvider, Disposable { key: 'vscode_send', payload: { key: 'changeFocusOnFile', - payload: { path: editor.document.uri.toString() }, + payload: { path: editor.document.uri.fsPath }, }, }) } @@ -84,7 +84,7 @@ export class LineagePanel implements WebviewViewProvider, Disposable { if (workspaceFolders.length != 1) { throw new Error('Only one workspace folder is supported') } - const fullPath = Uri.parse(message.payload.uri) + const fullPath = Uri.file(message.payload.filePath) const document = await workspace.openTextDocument(fullPath) await window.showTextDocument(document) break diff --git a/vscode/react/src/pages/lineage.tsx b/vscode/react/src/pages/lineage.tsx index 18925f28da..cca63e5f9a 100644 --- a/vscode/react/src/pages/lineage.tsx +++ b/vscode/react/src/pages/lineage.tsx @@ -13,7 +13,6 @@ import React, { useState } from 'react' import { ModelSQLMeshModel } from '@/domain/sqlmesh-model' import { useEventBus } from '@/hooks/eventBus' import type { VSCodeEvent } from '@bus/callbacks' -import { URI } from 'vscode-uri' import type { Model } from '@/api/client' import { useRpc } from '@/utils/rpc' import { @@ -98,13 +97,12 @@ function Lineage() { return models[0].name } // @ts-ignore - const fileUri: string = activeFile.fileUri - const filePath = URI.file(fileUri).path + const filePath: string = activeFile.fileUri const model = models.find((m: Model) => { if (!m.full_path) { return false } - return URI.file(m.full_path).path === filePath + return m.full_path === filePath }) if (model) { return model.name @@ -134,9 +132,8 @@ function Lineage() { React.useEffect(() => { const handleChangeFocusedFile = (fileUri: { fileUri: string }) => { - const full_path = URI.parse(fileUri.fileUri).path const model = Object.values(modelsRecord).find( - m => URI.file(m.full_path).path === full_path, + m => m.full_path === fileUri.fileUri, ) if (model) { setSelectedModel(model.name) @@ -201,7 +198,7 @@ export function LineageComponentFromWeb({ if (!model.full_path) { return } - vscode('openFile', { uri: URI.file(model.full_path).toString() }) + vscode('openFile', { filePath: model.full_path }) } function handleError(error: any): void {