From e2087614db620ad5aa670b4f82a243739d734eaf Mon Sep 17 00:00:00 2001 From: ochafik Date: Tue, 24 Dec 2024 14:29:43 +0000 Subject: [PATCH 1/2] Update links (no more ochafik-specific branch) --- src/components/HelpMenu.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/HelpMenu.tsx b/src/components/HelpMenu.tsx index 407b77a..eb9600d 100644 --- a/src/components/HelpMenu.tsx +++ b/src/components/HelpMenu.tsx @@ -13,13 +13,13 @@ export default function HelpMenu({className, style}: {className?: string, style? { label: "openscad-playground", icon: 'pi pi-github', - url: 'https://github.com/ochafik/openscad-playground/tree/color-assimp2', + url: 'https://github.com/openscad/openscad-playground/', target: '_blank' }, { label: 'LICENSES', icon: 'pi pi-info-circle', - url: 'https://github.com/ochafik/openscad-playground/blob/color-assimp2/LICENSE.md', + url: 'https://github.com/openscad/openscad-playground/blob/main/LICENSE.md', target: '_blank' }, { From 61f4bcc577572e06bf4ccd130502ca859c99bf94 Mon Sep 17 00:00:00 2001 From: ochafik Date: Wed, 25 Dec 2024 01:45:11 +0000 Subject: [PATCH 2/2] Drop readDirAsArray / use fs.readdirSync instead --- src/fs/filesystem.ts | 4 ---- src/language/openscad-completions.ts | 5 +++-- 2 files changed, 3 insertions(+), 6 deletions(-) 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) {