Skip to content

Commit

Permalink
fix: on treeview selection change only if fragment/line avail
Browse files Browse the repository at this point in the history
Do not change editor position if the tree view element doesn't contain a line info.
  • Loading branch information
mbehr1 committed Jan 17, 2021
1 parent 5593e42 commit 9f5d528
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/dltDocumentProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ export class DltDocumentProvider implements vscode.TreeDataProvider<TreeViewNode
treeDataProvider: this
});
this._subscriptions.push(this._dltLifecycleTreeView.onDidChangeSelection(event => {
console.log(`dltLifecycleTreeView.onDidChangeSelection(${event.selection.length} ${event.selection[0].uri})`);
if (event.selection.length && event.selection[0].uri) {
if (event.selection.length && event.selection[0].uri && event.selection[0].uri.fragment.length) {
console.log(`dltLifecycleTreeView.onDidChangeSelection(${event.selection.length} ${event.selection[0].uri} fragment='${event.selection[0].uri ? event.selection[0].uri.fragment : ''}')`);
// find the editor for this uri in active docs:
let uriWoFrag = event.selection[0].uri.with({ fragment: "" }).toString();
const activeTextEditors = vscode.window.visibleTextEditors;
Expand Down

0 comments on commit 9f5d528

Please sign in to comment.