|
1 | | -<<<<<<< HEAD |
2 | 1 | import { window, OutputChannel, Disposable } from "vscode" |
3 | 2 | import { ServerOptions, LanguageClientOptions, LanguageClient, TransportKind } from "vscode-languageclient/node" |
4 | 3 | import { sqlmesh_lsp_exec } from "../utilities/sqlmesh/sqlmesh" |
@@ -88,69 +87,3 @@ export class LSPClient implements Disposable { |
88 | 87 | await this.stop() |
89 | 88 | } |
90 | 89 | } |
91 | | -======= |
92 | | -import path from "path"; |
93 | | -import { workspace, ExtensionContext, OutputChannel, window } from "vscode"; |
94 | | -import { ServerOptions, LanguageClientOptions, LanguageClient, TransportKind } from "vscode-languageclient/node"; |
95 | | -import { sqlmesh_exec, sqlmesh_lsp_exec } from "../sqlmesh/sqlmesh"; |
96 | | -import { err, isErr, ok, Result } from "../functional/result"; |
97 | | -import { getWorkspaceFolders } from "../common/vscodeapi"; |
98 | | - |
99 | | -let client: LanguageClient; |
100 | | - |
101 | | -export async function activateLsp(context: ExtensionContext): Promise<Result<undefined, string>> { |
102 | | - const sqlmesh = await sqlmesh_lsp_exec() |
103 | | - if (isErr(sqlmesh)) { |
104 | | - return sqlmesh |
105 | | - } |
106 | | - const workspaceFolders = getWorkspaceFolders() |
107 | | - if (workspaceFolders.length !== 1) { |
108 | | - return err("Invalid number of workspace folders") |
109 | | - } |
110 | | - const outputChannel: OutputChannel = window.createOutputChannel('sqlmesh_actual_lsp_implementation'); |
111 | | - |
112 | | - let folder = workspaceFolders[0] |
113 | | - const workspacePath = workspaceFolders[0].uri.fsPath |
114 | | - let serverOptions: ServerOptions = { |
115 | | - run: { |
116 | | - command: sqlmesh.value.bin, |
117 | | - transport: TransportKind.stdio, |
118 | | - options: { |
119 | | - cwd: workspacePath, |
120 | | - }, |
121 | | - }, |
122 | | - debug: { |
123 | | - command: sqlmesh.value.bin, |
124 | | - transport: TransportKind.stdio, |
125 | | - options: { |
126 | | - cwd: workspacePath, |
127 | | - } |
128 | | - } |
129 | | - } |
130 | | - let clientOptions: LanguageClientOptions = { |
131 | | - documentSelector: [ |
132 | | - { scheme: 'file', pattern: `**/*.sql` } |
133 | | - ], |
134 | | - workspaceFolder: folder, |
135 | | - diagnosticCollectionName: 'sqlmesh', |
136 | | - outputChannel: outputChannel, |
137 | | - // synchronize: { |
138 | | - // fileEvents: workspace.createFileSystemWatcher('**/*.{sql,py}'), |
139 | | - // } |
140 | | - } |
141 | | - |
142 | | - client = new LanguageClient('sqlmesh-lsp-example', 'SQLMesh Language Server', serverOptions, clientOptions) |
143 | | - console.log('Starting language client') |
144 | | - client.start() |
145 | | - |
146 | | - console.log('Language client started') |
147 | | - return ok(undefined) |
148 | | -} |
149 | | - |
150 | | -export async function deactivateLsp() { |
151 | | - if (client) { |
152 | | - await client.stop() |
153 | | - } |
154 | | -} |
155 | | - |
156 | | ->>>>>>> 0b5bbfc9 (trying to implement lsp) |
0 commit comments