Skip to content

Commit 7ca07fd

Browse files
committed
refactor get uri functions
1 parent a63a666 commit 7ca07fd

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/markupParser.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,22 @@ function imageUri(searchUri: vscode.Uri, imageLink: string) {
2020
}
2121

2222
function getUri(filepath: string, filename: string) {
23-
let extension = vscode.extensions.getExtension(EXTENTION_ID);
23+
const extension = vscode.extensions.getExtension(EXTENTION_ID);
2424
if (extension) {
25-
let extPath = extension.extensionPath;
25+
const extPath = extension.extensionPath;
2626

2727
// set special chema for resource:
2828
// https://code.visualstudio.com/api/extension-guides/webview#loading-local-content
29-
let uri = vscode.Uri.file(path.join(extPath, filepath, filename)).with({ scheme: 'vscode-resource' });
30-
return uri;
29+
const uri = vscode.Uri.file(path.join(extPath, filepath, filename))
30+
return uri
3131
}
3232
}
3333

3434
function emoticonUri(emoticonFile: string) {
35-
return getUri(EMOTICON_PATH, emoticonFile);
35+
const emoticonUrl = getUri(EMOTICON_PATH, emoticonFile)
36+
if (emoticonUrl) {
37+
return emoticonUrl.with({scheme: 'vscode-resource'});
38+
}
3639
}
3740

3841
export function cssUri(cssFile: string) {

0 commit comments

Comments
 (0)