diff --git a/src/fs/filesystem.ts b/src/fs/filesystem.ts index 8bd3406..4fd18aa 100644 --- a/src/fs/filesystem.ts +++ b/src/fs/filesystem.ts @@ -15,10 +15,6 @@ export const getParentDir = (path: string) => { return d === '' ? (path.startsWith('/') ? '/' : '.') : d; } -export function readDirAsArray(fs: FS, path: string): Promise { - 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); diff --git a/src/language/openscad-completions.ts b/src/language/openscad-completions.ts index 2951b63..1e84085 100644 --- a/src/language/openscad-completions.ts +++ b/src/language/openscad-completions.ts @@ -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) {