Skip to content

Commit

Permalink
fix #6801: convert viewColumn to zero-based index inside toEditorOpen…
Browse files Browse the repository at this point in the history
…erOptions() method

Signed-off-by: Gan Lin <ganlinbupt@163.com>
  • Loading branch information
Gan Lin authored and akosyakov committed Jan 6, 2020
1 parent 881965a commit 9404b2e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import { EditorManager } from '@theia/editor/lib/browser';
import { TextDocumentShowOptions } from '@theia/plugin-ext/lib/common/plugin-api-rpc-model';
import { DocumentsMainImpl } from '@theia/plugin-ext/lib/main/browser/documents-main';
import { createUntitledResource } from '@theia/plugin-ext/lib/main/browser/editor/untitled-resource';
import { fromViewColumn, toDocumentSymbol } from '@theia/plugin-ext/lib/plugin/type-converters';
import { toDocumentSymbol } from '@theia/plugin-ext/lib/plugin/type-converters';
import { ViewColumn } from '@theia/plugin-ext/lib/plugin/types-impl';
import { WorkspaceCommands } from '@theia/workspace/lib/browser';
import { DiffService } from '@theia/workspace/lib/browser/diff-service';
Expand Down Expand Up @@ -89,12 +89,11 @@ export class PluginVscodeCommandsContribution implements CommandContribution {
let options: TextDocumentShowOptions | undefined;
if (typeof columnOrOptions === 'number') {
options = {
viewColumn: fromViewColumn(columnOrOptions)
viewColumn: columnOrOptions
};
} else if (columnOrOptions) {
options = {
...columnOrOptions,
viewColumn: fromViewColumn(columnOrOptions.viewColumn)
...columnOrOptions
};
}
const editorOptions = DocumentsMainImpl.toEditorOpenerOptions(this.shell, options);
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-ext/src/main/browser/documents-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ export class DocumentsMainImpl implements DocumentsMain, Disposable {
widgetOptions = undefined;
} else if (viewColumn > 0) {
const tabBars = shell.mainAreaTabBars;
const tabBar = tabBars[viewColumn];
// convert to zero-based index
const tabBar = tabBars[viewColumn - 1];
if (tabBar && tabBar.currentTitle) {
widgetOptions = { ref: tabBar.currentTitle.owner };
}
Expand Down

0 comments on commit 9404b2e

Please sign in to comment.