Skip to content
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
debug.json
debug.js
target/
.vscode
16 changes: 8 additions & 8 deletions lsp/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @format
*/

import {ExtensionContext, workspace} from 'vscode';
import { ExtensionContext, workspace } from 'vscode';
import * as vscode from 'vscode';
import {
CancellationToken,
Expand All @@ -21,7 +21,7 @@ import {
ResponseError,
ServerOptions,
} from 'vscode-languageclient/node';
import {PythonExtension} from '@vscode/python-extension';
import { PythonExtension } from '@vscode/python-extension';

let client: LanguageClient;
let statusBarItem: vscode.StatusBarItem;
Expand Down Expand Up @@ -131,18 +131,18 @@ async function overridePythonPath(
) {
return undefined;
}
let scopeUri = configurationItems[index].scopeUri;
return await pythonExtension.environments.getActiveEnvironmentPath(
scopeUri === undefined ? undefined : vscode.Uri.file(scopeUri),
).path;
const scopeUri = configurationItems[index].scopeUri;
const resource = scopeUri === undefined ? undefined : vscode.Uri.parse(scopeUri);
const env = await pythonExtension.environments.getActiveEnvironmentPath(resource);
return env?.path;
};
const newResult = await Promise.all(
configuration.map(async (item, index) => {
const pythonPath = await getPythonPathForConfigurationItem(index);
if (pythonPath === undefined) {
return item;
} else {
return {...item, pythonPath};
return { ...item, pythonPath };
}
}),
);
Expand Down Expand Up @@ -173,7 +173,7 @@ export async function activate(context: ExtensionContext) {
let clientOptions: LanguageClientOptions = {
initializationOptions: rawInitialisationOptions,
// Register the server for Starlark documents
documentSelector: [{scheme: 'file', language: 'python'}],
documentSelector: [{ scheme: 'file', language: 'python' }],
middleware: {
workspace: {
configuration: async (
Expand Down
3 changes: 1 addition & 2 deletions pyrefly/lib/lsp/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ impl LspEvent {
| Self::DidChangeWatchedFiles(_)
| Self::DidChangeWorkspaceFolders(_)
| Self::DidChangeConfiguration(_)
| Self::LspResponse(_)
| Self::Exit => LspEventKind::Mutation,
Self::LspRequest(_) => LspEventKind::Query,
Self::LspRequest(_) | Self::LspResponse(_) => LspEventKind::Query,
}
}
}
Expand Down
Loading