Skip to content

Commit

Permalink
Open editor containing query location in non-preview mode
Browse files Browse the repository at this point in the history
  • Loading branch information
aeisenberg committed Nov 4, 2020
1 parent 2ac7881 commit 5a3142a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions extensions/ql-vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
- Add a `View DIL` command on query history items. This opens a text editor containing the Datalog Intermediary Language representation of the compiled query.
- Remove feature flag for the AST Viewer. For more information on how to use the AST Viewer, [see the documentation](https://help.semmle.com/codeql/codeql-for-vscode/procedures/exploring-the-structure-of-your-source-code.html).
- The `codeQL.runningTests.numberOfThreads` setting is now used correctly when running tests.
- Add the `codeQL.ui.openInPreviewEditor` config option. This option allows users to open query results in non-preview editors (by un-checking this option). Doing so will make navigation between results files easier, but may also contribute to a proliferation of open editors.

## 1.3.3 - 16 September 2020

Expand Down
5 changes: 5 additions & 0 deletions extensions/ql-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@
"type": "object",
"title": "CodeQL",
"properties": {
"codeQL.ui.openInPreviewEditor": {
"type": "boolean",
"default": true,
"markdownDescription": "When enabled (default), query results will in a _preview_ editor. Disabling will make navigation between results easier, but will also result in a proliferation of open editors."
},
"codeQL.cli.executablePath": {
"scope": "machine",
"type": "string",
Expand Down
7 changes: 6 additions & 1 deletion extensions/ql-vscode/src/interface-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,12 @@ export async function showLocation(location?: Location) {
const editor =
editorsWithDoc.length > 0
? editorsWithDoc[0]
: await Window.showTextDocument(doc, ViewColumn.One);
: await Window.showTextDocument(
doc, {
preview: true,
viewColumn: ViewColumn.One,
});

const range = location.range;
// When highlighting the range, vscode's occurrence-match and bracket-match highlighting will
// trigger based on where we place the cursor/selection, and will compete for the user's attention.
Expand Down

0 comments on commit 5a3142a

Please sign in to comment.