Use canonical uri for openTextDocument api, #93368

This commit is contained in:
Johannes Rieken
2020-05-29 18:16:21 +02:00
parent 4d854d4c89
commit b0d056202b
9 changed files with 94 additions and 34 deletions

View File

@@ -48,9 +48,12 @@ class Directory implements vscode.FileStat {
export type Entry = File | Directory;
export class MemFS implements vscode.FileSystemProvider {
export class TestFS implements vscode.FileSystemProvider {
readonly scheme = 'fake-fs';
constructor(
readonly scheme: string,
readonly isCaseSensitive: boolean
) { }
readonly root = new Directory('');
@@ -161,12 +164,22 @@ export class MemFS implements vscode.FileSystemProvider {
let parts = uri.path.split('/');
let entry: Entry = this.root;
for (const part of parts) {
const partLow = part.toLowerCase();
if (!part) {
continue;
}
let child: Entry | undefined;
if (entry instanceof Directory) {
child = entry.entries.get(part);
if (this.isCaseSensitive) {
child = entry.entries.get(part);
} else {
for (let [key, value] of entry.entries) {
if (key.toLowerCase() === partLow) {
child = value;
break;
}
}
}
}
if (!child) {
if (!silent) {