File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
extensions/markdown-language-features/src Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,6 @@ import { IMdParser } from '../markdownEngine';
9
9
import { TableOfContents } from '../tableOfContents' ;
10
10
import { ITextDocument } from '../types/textDocument' ;
11
11
import { resolveUriToMarkdownFile } from '../util/openDocumentLink' ;
12
- import { Schemes } from '../util/schemes' ;
13
12
import { IMdWorkspace } from '../workspace' ;
14
13
import { MdLinkProvider } from './documentLinks' ;
15
14
@@ -325,7 +324,7 @@ export class MdVsCodePathCompletionProvider implements vscode.CompletionItemProv
325
324
326
325
private resolvePath ( root : vscode . Uri , ref : string ) : vscode . Uri | undefined {
327
326
try {
328
- if ( root . scheme === Schemes . file ) {
327
+ if ( root . scheme === ' file' ) {
329
328
return vscode . Uri . file ( resolve ( dirname ( root . fsPath ) , ref ) ) ;
330
329
} else {
331
330
return root . with ( {
Original file line number Diff line number Diff line change 4
4
*--------------------------------------------------------------------------------------------*/
5
5
6
6
import * as assert from 'assert' ;
7
+ import * as path from 'path' ;
7
8
import * as vscode from 'vscode' ;
8
9
import { ITextDocument } from '../types/textDocument' ;
9
10
import { ResourceMap } from '../util/resourceMap' ;
@@ -37,11 +38,11 @@ export class InMemoryMdWorkspace implements IMdWorkspace {
37
38
38
39
public async readDirectory ( resource : vscode . Uri ) : Promise < [ string , vscode . FileType ] [ ] > {
39
40
const files = new Map < string , vscode . FileType > ( ) ;
40
- const pathPrefix = resource . fsPath + ( resource . fsPath . endsWith ( '/' ) ? '' : '/' ) ;
41
+ const pathPrefix = resource . fsPath + ( resource . fsPath . endsWith ( '/' ) || resource . fsPath . endsWith ( '\\' ) ? '' : path . sep ) ;
41
42
for ( const doc of this . _documents . values ( ) ) {
42
43
const path = doc . uri . fsPath ;
43
44
if ( path . startsWith ( pathPrefix ) ) {
44
- const parts = path . slice ( pathPrefix . length ) . split ( '/' ) ;
45
+ const parts = path . slice ( pathPrefix . length ) . split ( / \/ | \\ / g ) ;
45
46
files . set ( parts [ 0 ] , parts . length > 1 ? vscode . FileType . Directory : vscode . FileType . File ) ;
46
47
}
47
48
}
You can’t perform that action at this time.
0 commit comments