Commit 6a6f9e4 1 parent 37e4f68 commit 6a6f9e4 Copy full SHA for 6a6f9e4
File tree 2 files changed +15
-7
lines changed
2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 1
1
import type { ComputedRef , MaybeRefOrGetter } from '@reactive-vscode/reactivity'
2
2
import { computed , toValue } from '@reactive-vscode/reactivity'
3
- import { extensionContext } from '../utils'
3
+ import { asAbsolutePath } from '../utils/asAbsolutePath '
4
4
5
5
/**
6
6
* @category utilities
@@ -9,10 +9,5 @@ import { extensionContext } from '../utils'
9
9
export function useAbsolutePath ( relativePath : MaybeRefOrGetter < string > , slient : true ) : ComputedRef < string | undefined >
10
10
export function useAbsolutePath ( relativePath : MaybeRefOrGetter < string > , slient ?: false ) : ComputedRef < string >
11
11
export function useAbsolutePath ( relativePath : MaybeRefOrGetter < string > , slient = false ) {
12
- return computed ( ( ) => {
13
- const extCtx = extensionContext . value
14
- if ( ! extCtx && ! slient )
15
- throw new Error ( 'Cannot get absolute path because the extension is not activated yet' )
16
- return extCtx ?. asAbsolutePath ( toValue ( relativePath ) )
17
- } )
12
+ return computed ( ( ) => asAbsolutePath ( toValue ( relativePath ) , slient ) )
18
13
}
Original file line number Diff line number Diff line change
1
+ import { extensionContext } from '../utils'
2
+
3
+ /**
4
+ * A shorthand for `vscode::ExtensionContext.asAbsolutePath`
5
+ */
6
+ export function asAbsolutePath ( relativePath : string , slient ?: false ) : string
7
+ export function asAbsolutePath ( relativePath : string , slient ?: boolean ) : string | undefined
8
+ export function asAbsolutePath ( relativePath : string , slient = false ) {
9
+ const extCtx = extensionContext . value
10
+ if ( ! extCtx && ! slient )
11
+ throw new Error ( 'Cannot get absolute path because the extension is not activated yet' )
12
+ return extCtx ?. asAbsolutePath ( relativePath )
13
+ }
You can’t perform that action at this time.
0 commit comments