mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
parent
09c5a6ed48
commit
d1b4630a50
|
@ -9,7 +9,6 @@ import { IMdParser } from '../markdownEngine';
|
|||
import { TableOfContents } from '../tableOfContents';
|
||||
import { ITextDocument } from '../types/textDocument';
|
||||
import { resolveUriToMarkdownFile } from '../util/openDocumentLink';
|
||||
import { Schemes } from '../util/schemes';
|
||||
import { IMdWorkspace } from '../workspace';
|
||||
import { MdLinkProvider } from './documentLinks';
|
||||
|
||||
|
@ -325,7 +324,7 @@ export class MdVsCodePathCompletionProvider implements vscode.CompletionItemProv
|
|||
|
||||
private resolvePath(root: vscode.Uri, ref: string): vscode.Uri | undefined {
|
||||
try {
|
||||
if (root.scheme === Schemes.file) {
|
||||
if (root.scheme === 'file') {
|
||||
return vscode.Uri.file(resolve(dirname(root.fsPath), ref));
|
||||
} else {
|
||||
return root.with({
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import * as path from 'path';
|
||||
import * as vscode from 'vscode';
|
||||
import { ITextDocument } from '../types/textDocument';
|
||||
import { ResourceMap } from '../util/resourceMap';
|
||||
|
@ -37,11 +38,11 @@ export class InMemoryMdWorkspace implements IMdWorkspace {
|
|||
|
||||
public async readDirectory(resource: vscode.Uri): Promise<[string, vscode.FileType][]> {
|
||||
const files = new Map<string, vscode.FileType>();
|
||||
const pathPrefix = resource.fsPath + (resource.fsPath.endsWith('/') ? '' : '/');
|
||||
const pathPrefix = resource.fsPath + (resource.fsPath.endsWith('/') || resource.fsPath.endsWith('\\') ? '' : path.sep);
|
||||
for (const doc of this._documents.values()) {
|
||||
const path = doc.uri.fsPath;
|
||||
if (path.startsWith(pathPrefix)) {
|
||||
const parts = path.slice(pathPrefix.length).split('/');
|
||||
const parts = path.slice(pathPrefix.length).split(/\/|\\/g);
|
||||
files.set(parts[0], parts.length > 1 ? vscode.FileType.Directory : vscode.FileType.File);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue