File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 9
9
observeConfigurationChange ,
10
10
observeWorkspaceFolderAndFileChange as observeWorkspaceFolderChange ,
11
11
} from './services/check-workspace' ;
12
+ import { EditPostUriHandler } from './services/edit-post-uri-handler' ;
12
13
13
14
// this method is called when your extension is activated
14
15
// your extension is activated the very first time the command is executed
@@ -21,6 +22,7 @@ export function activate(context: vscode.ExtensionContext) {
21
22
registerTreeViews ( ) ;
22
23
observeConfigurationChange ( ) ;
23
24
observeWorkspaceFolderChange ( ) ;
25
+ vscode . window . registerUriHandler ( new EditPostUriHandler ( ) ) ;
24
26
}
25
27
26
28
// this method is called when your extension is deactivated
Original file line number Diff line number Diff line change
1
+ import { ProviderResult , Uri , UriHandler } from 'vscode' ;
2
+ import { openPostInVscode } from '../commands/posts-list/open-post-in-vscode' ;
3
+
4
+ export class EditPostUriHandler implements UriHandler {
5
+ handleUri ( uri : Uri ) : ProviderResult < void > {
6
+ const { path } = uri ;
7
+ const splits = path . split ( '/' ) ;
8
+ if ( splits . length >= 3 && splits [ 1 ] === 'edit-post' ) {
9
+ const postId = parseInt ( splits [ 2 ] ) ;
10
+ if ( postId > 0 ) {
11
+ openPostInVscode ( postId ) . then ( undefined , ( ) => void 0 ) ;
12
+ }
13
+ }
14
+ }
15
+ }
You can’t perform that action at this time.
0 commit comments