Drop readDirAsArray / use fs.readdirSync instead
This commit is contained in:
parent
cde9d907a4
commit
909e4a8231
2 changed files with 3 additions and 6 deletions
|
|
@ -15,10 +15,6 @@ export const getParentDir = (path: string) => {
|
|||
return d === '' ? (path.startsWith('/') ? '/' : '.') : d;
|
||||
}
|
||||
|
||||
export function readDirAsArray(fs: FS, path: string): Promise<string[] | undefined> {
|
||||
return new Promise((res, rej) => fs.readdir(path, (err, files) => err ? rej(err) : res(files)));
|
||||
}
|
||||
|
||||
export function join(a: string, b: string): string {
|
||||
if (a === '.') return b;
|
||||
if (a.endsWith('/')) return join(a.substring(0, a.length - 1), b);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Portions of this file are Copyright 2021 Google LLC, and licensed under GPL2+. See COPYING.
|
||||
|
||||
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
|
||||
import { join, readDirAsArray, Symlinks } from '../fs/filesystem';
|
||||
import { join, Symlinks } from '../fs/filesystem';
|
||||
import { ParsedFile, ParsedFunctionoidDef, parseOpenSCAD, stripComments } from './openscad-pseudoparser';
|
||||
import builtinSignatures from './openscad-builtins'
|
||||
import { mapObject } from '../utils';
|
||||
|
|
@ -192,7 +192,8 @@ export async function buildOpenSCADCompletionItemProvider(fs: FS, workingDir: st
|
|||
for (const folder of [join('/libraries', folderName), join(workingDir, folderName)]) {
|
||||
files = folderPrefix == '' ? [...Object.keys(allSymlinks)] : [];
|
||||
try {
|
||||
files = [...(await readDirAsArray(fs, folder) ?? []), ...files];
|
||||
files = [...(fs.readdirSync(folder) ?? []), ...files];
|
||||
// files = [...(await readDirAsArray(fs, folder) ?? []), ...files];
|
||||
// console.log('readDir', folder, files);
|
||||
break;
|
||||
} catch (e) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue