Skip to content

Commit 38cc76e

Browse files
undo debugging changes
1 parent 89ac03a commit 38cc76e

File tree

6 files changed

+15
-29
lines changed

6 files changed

+15
-29
lines changed

Cargo.lock

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/pg_lsp_new/Cargo.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ name = "pg_lsp_new"
1010
repository.workspace = true
1111
version = "0.0.0"
1212

13-
[[bin]]
14-
name = "pglsp_new"
15-
path = "src/main.rs"
16-
test = false
1713

1814
[dependencies]
1915
anyhow = { workspace = true }
@@ -22,7 +18,6 @@ futures = "0.3.31"
2218
pg_configuration = { workspace = true }
2319
pg_console = { workspace = true }
2420
pg_diagnostics = { workspace = true }
25-
pg_completions = { workspace = true }
2621
pg_fs = { workspace = true }
2722
pg_lsp_converters = { workspace = true }
2823
pg_text_edit = { workspace = true }
@@ -34,7 +29,6 @@ text-size.workspace = true
3429
tokio = { workspace = true, features = ["rt", "io-std"] }
3530
tower-lsp = { version = "0.20.0" }
3631
tracing = { workspace = true, features = ["attributes"] }
37-
tracing-subscriber = { workspace = true }
3832

3933
[dev-dependencies]
4034

crates/pg_lsp_new/src/server.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,20 +163,20 @@ impl LanguageServer for LSPServer {
163163
self.session.update_all_diagnostics().await;
164164
}
165165

166-
#[tracing::instrument(level = "info", skip(self))]
166+
#[tracing::instrument(level = "info", skip_all)]
167167
async fn shutdown(&self) -> LspResult<()> {
168168
Ok(())
169169
}
170170

171-
#[tracing::instrument(level = "info", skip(self))]
171+
#[tracing::instrument(level = "info", skip_all)]
172172
async fn did_change_configuration(&self, params: DidChangeConfigurationParams) {
173173
let _ = params;
174174
self.session.load_workspace_settings().await;
175175
self.setup_capabilities().await;
176176
self.session.update_all_diagnostics().await;
177177
}
178178

179-
#[tracing::instrument(level = "info", skip(self))]
179+
#[tracing::instrument(level = "trace", skip(self))]
180180
async fn did_change_watched_files(&self, params: DidChangeWatchedFilesParams) {
181181
let file_paths = params
182182
.changes
@@ -238,7 +238,7 @@ impl LanguageServer for LSPServer {
238238
.ok();
239239
}
240240

241-
#[tracing::instrument(level = "info", skip(self))]
241+
#[tracing::instrument(level = "trace", skip(self))]
242242
async fn completion(&self, params: CompletionParams) -> LspResult<Option<CompletionResponse>> {
243243
match handlers::completions::get_completions(&self.session, params) {
244244
Ok(result) => LspResult::Ok(Some(result)),

crates/pg_workspace_new/src/workspace/server.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,16 +363,15 @@ impl Workspace for WorkspaceServer {
363363
Some(s) => s,
364364
None => return Ok(pg_completions::CompletionResult::default()),
365365
};
366-
let statement_ref = &statement.ref_;
367366

368367
// `offset` is the position in the document,
369368
// but we need the position within the *statement*.
370369
let stmt_range = doc
371-
.statement_range(statement_ref)
370+
.statement_range(&statement.ref_)
372371
.expect("Range of statement should be defined.");
373372
let position = params.position - stmt_range.start();
374373

375-
let tree = self.tree_sitter.fetch(statement_ref);
374+
let tree = self.tree_sitter.fetch(&statement.ref_);
376375
let text = statement.text;
377376

378377
tracing::info!("Found the statement. We're looking for position {:?}. Statement Range {:?} to {:?}. Statement: {}", position, stmt_range.start(), stmt_range.end(), text);

editors/code/src/main.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type ExtensionContext, window } from 'vscode';
1+
import type { ExtensionContext } from 'vscode';
22

33
import {
44
type Executable,
@@ -9,39 +9,37 @@ import {
99

1010
let client: LanguageClient;
1111

12-
export async function activate(_context: ExtensionContext) {
12+
export function activate(_context: ExtensionContext) {
1313
// If the extension is launched in debug mode then the debug server options are used
1414
// Otherwise the run options are used
1515
const run: Executable = {
16-
command: 'pglsp_new'
16+
command: 'pglsp'
1717
};
1818

19+
// const outputChannel = window.createOutputChannel('postgres_lsp');
20+
1921
const serverOptions: ServerOptions = {
2022
run,
2123
debug: run
2224
};
2325

24-
const outputChannel = window.createOutputChannel('Postgres LSP', { log: true });
25-
2626
// Options to control the language client
2727
const clientOptions: LanguageClientOptions = {
2828
// Register the server for plain text documents
29-
documentSelector: [{ scheme: 'file', language: 'sql' }],
30-
outputChannel
29+
documentSelector: [{ scheme: 'file', language: 'sql' }]
3130
};
3231

3332
// Create the language client and start the client.
3433
client = new LanguageClient('postgres_lsp', 'Postgres LSP', serverOptions, clientOptions);
3534

3635
// Start the client. This will also launch the server
37-
await client.start();
36+
void client.start();
3837
}
3938

4039
export function deactivate(): Thenable<void> | undefined {
4140
console.log('Deactivating client...');
4241
if (!client) {
4342
return undefined;
4443
}
45-
4644
return client.stop();
4745
}

xtask/src/install.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ impl flags::Install {
1212
if cfg!(target_os = "macos") {
1313
fix_path_for_mac(sh).context("Fix path for mac")?;
1414
}
15-
if let Some(_) = self.server() {
15+
if self.server().is_some() {
1616
install_server(sh).context("install server")?;
1717
}
1818
if let Some(client) = self.client() {
@@ -137,10 +137,7 @@ fn install_client(sh: &Shell, client_opt: ClientOpt) -> anyhow::Result<()> {
137137
}
138138

139139
fn install_server(sh: &Shell) -> anyhow::Result<()> {
140-
let cmd = cmd!(
141-
sh,
142-
"cargo install --path crates/pg_lsp_new --locked --force"
143-
);
140+
let cmd = cmd!(sh, "cargo install --path crates/pg_lsp --locked --force");
144141
cmd.run()?;
145142
Ok(())
146143
}

0 commit comments

Comments
 (0)