File tree Expand file tree Collapse file tree 3 files changed +13
-8
lines changed
extensions/markdown-language-features/src
languageFeatures/copyFiles Expand file tree Collapse file tree 3 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,8 @@ import * as vscode from 'vscode';
7
7
import { IMdParser } from '../../markdownEngine' ;
8
8
import { ITextDocument } from '../../types/textDocument' ;
9
9
import { Mime } from '../../util/mimes' ;
10
- import { createInsertUriListEdit , externalUriSchemes } from './shared' ;
10
+ import { createInsertUriListEdit } from './shared' ;
11
+ import { Schemes } from '../../util/schemes' ;
11
12
12
13
export enum PasteUrlAsMarkdownLink {
13
14
Always = 'always' ,
@@ -170,6 +171,14 @@ async function shouldSmartPasteForSelection(
170
171
return true ;
171
172
}
172
173
174
+
175
+ const externalUriSchemes : ReadonlySet < string > = new Set ( [
176
+ Schemes . http ,
177
+ Schemes . https ,
178
+ Schemes . mailto ,
179
+ Schemes . file ,
180
+ ] ) ;
181
+
173
182
export function findValidUriInText ( text : string ) : string | undefined {
174
183
const trimmedUrlList = text . trim ( ) ;
175
184
@@ -186,7 +195,7 @@ export function findValidUriInText(text: string): string | undefined {
186
195
return ;
187
196
}
188
197
189
- if ( ! externalUriSchemes . includes ( uri . scheme . toLowerCase ( ) ) || uri . authority . length <= 1 ) {
198
+ if ( ! externalUriSchemes . has ( uri . scheme . toLowerCase ( ) ) || uri . authority . length <= 1 ) {
190
199
return ;
191
200
}
192
201
Original file line number Diff line number Diff line change @@ -19,12 +19,6 @@ enum MediaKind {
19
19
Audio ,
20
20
}
21
21
22
- export const externalUriSchemes = [
23
- 'http' ,
24
- 'https' ,
25
- 'mailto' ,
26
- ] ;
27
-
28
22
export const mediaFileExtensions = new Map < string , MediaKind > ( [
29
23
// Images
30
24
[ 'bmp' , MediaKind . Image ] ,
Original file line number Diff line number Diff line change 4
4
*--------------------------------------------------------------------------------------------*/
5
5
6
6
export const Schemes = Object . freeze ( {
7
+ http : 'http' ,
8
+ https : 'https' ,
7
9
file : 'file' ,
8
10
untitled : 'untitled' ,
9
11
mailto : 'mailto' ,
You can’t perform that action at this time.
0 commit comments