Skip to content

Commit

Permalink
Slight change in behaviour: Dont reset highlights if kernel is busy (…
Browse files Browse the repository at this point in the history
… i prefer it this way)
  • Loading branch information
micoloth committed Mar 3, 2024
1 parent 4480a4f commit a04cc5e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"color": "#ffffff",
"theme": "light"
},
"version": "0.2.0",
"version": "0.2.1",
"engines": {
"vscode": "^1.85.0"
},
Expand Down
17 changes: 6 additions & 11 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1107,19 +1107,14 @@ function getEditingState(globals: Map<string, string>, editor: TextEditor): [Edi
function getOnDidChangeTextEditorSelectionAction(globals: Map<string, string>, output: OutputChannel, codelensProvider: CellCodelensProvider) {
return async (event: vscode.TextEditorSelectionChangeEvent): Promise<void> => {
let editor = window.activeTextEditor;
if (event.textEditor &&
editor &&
event.textEditor.document === editor.document &&
editor.selection.isEmpty &&
getKernelState(globals, editor) == KernelState.extension_available &&
getEditingState(globals, editor)[0] == EditingState.rebuilt) {
let current_ranges = await getCurrentRangesFromPython(editor, output, globals, { rebuild: false });
updateDecorations(editor, current_ranges ? current_ranges : []);
let codelense_range = current_ranges ? current_ranges.filter((r) => (r.current && r.state != 'syntaxerror')).map((r) => r.range) : [];
codelensProvider.change_range(codelense_range.length > 0 ? codelense_range[0] : undefined);
} else {
if (!(event.textEditor && editor && event.textEditor.document === editor.document && editor.selection.isEmpty)) {
updateDecorations(event.textEditor, []);
codelensProvider.change_range(undefined);
} else if (getKernelState(globals, editor) == KernelState.extension_available && getEditingState(globals, editor)[0] == EditingState.rebuilt) {
let current_ranges = await getCurrentRangesFromPython(editor, output, globals, { rebuild: false });
updateDecorations(editor, current_ranges ? current_ranges : []);
let codelense_range = current_ranges ? current_ranges.filter((r) => (r.current && r.state != 'syntaxerror')).map((r) => r.range) : [];
codelensProvider.change_range(codelense_range.length > 0 ? codelense_range[0] : undefined);
}
};
}
Expand Down

0 comments on commit a04cc5e

Please sign in to comment.