File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 11import {
22 commands ,
3- ExtensionContext ,
3+ window ,
44 Disposable ,
5+ ExtensionContext ,
6+ Uri
57} from 'vscode' ;
68
79import { ViewCommands } from './viewCommands' ;
@@ -15,8 +17,17 @@ import { TableView } from '../views/tableView';
1517 */
1618export async function registerOpenTextDocumentCommand ( context : ExtensionContext ) {
1719 const openTextDocumentCommand : Disposable =
18- commands . registerCommand ( ViewCommands . openTextDocument , ( ) => {
19- commands . executeCommand ( ViewCommands . vscodeOpen , TableView . currentView ?. documentUri ) ;
20+ commands . registerCommand ( ViewCommands . openTextDocument , ( textDocumentUri : Uri ) => {
21+ if ( ! textDocumentUri && TableView . currentView ?. documentUri ) {
22+ // use current table view document uri
23+ textDocumentUri = TableView . currentView . documentUri ;
24+ }
25+
26+ if ( textDocumentUri ) {
27+ // use built-in vscode open command to show text document in code editor
28+ commands . executeCommand ( ViewCommands . vscodeOpen , TableView . currentView ?. documentUri ) ;
29+ }
2030 } ) ;
31+
2132 context . subscriptions . push ( openTextDocumentCommand ) ;
2233}
You can’t perform that action at this time.
0 commit comments