- Hover provider showing entity information and type - Go-to-definition (F12) for entity references - Basic IFC file validation (ISO-10303-21 header check) - Entity parsing with regex-based detection - Proper CommonJS module system (avoiding ES module issues) This replaces the broken baseline from ifc-developer-tools which had: - Non-functional ES module configuration - Circular dependency issues - Parser crashes - Non-working PositionVisitor Built on Microsoft's LSP example template for a clean, maintainable foundation. Next: Add hierarchical entity dependency tree in hover tooltip."
57 lines
1.9 KiB
JavaScript
57 lines
1.9 KiB
JavaScript
"use strict";
|
|
/* --------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
* ------------------------------------------------------------------------------------------ */
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.asPromise = exports.thenable = exports.typedArray = exports.stringArray = exports.array = exports.func = exports.error = exports.number = exports.string = exports.boolean = void 0;
|
|
function boolean(value) {
|
|
return value === true || value === false;
|
|
}
|
|
exports.boolean = boolean;
|
|
function string(value) {
|
|
return typeof value === 'string' || value instanceof String;
|
|
}
|
|
exports.string = string;
|
|
function number(value) {
|
|
return typeof value === 'number' || value instanceof Number;
|
|
}
|
|
exports.number = number;
|
|
function error(value) {
|
|
return value instanceof Error;
|
|
}
|
|
exports.error = error;
|
|
function func(value) {
|
|
return typeof value === 'function';
|
|
}
|
|
exports.func = func;
|
|
function array(value) {
|
|
return Array.isArray(value);
|
|
}
|
|
exports.array = array;
|
|
function stringArray(value) {
|
|
return array(value) && value.every(elem => string(elem));
|
|
}
|
|
exports.stringArray = stringArray;
|
|
function typedArray(value, check) {
|
|
return Array.isArray(value) && value.every(check);
|
|
}
|
|
exports.typedArray = typedArray;
|
|
function thenable(value) {
|
|
return value && func(value.then);
|
|
}
|
|
exports.thenable = thenable;
|
|
function asPromise(value) {
|
|
if (value instanceof Promise) {
|
|
return value;
|
|
}
|
|
else if (thenable(value)) {
|
|
return new Promise((resolve, reject) => {
|
|
value.then((resolved) => resolve(resolved), (error) => reject(error));
|
|
});
|
|
}
|
|
else {
|
|
return Promise.resolve(value);
|
|
}
|
|
}
|
|
exports.asPromise = asPromise;
|