UNPKG

greybel-languageserver-core

Version:
53 lines 2.52 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getAllDependencyLocationsFromGraph = exports.parseDependencyRawLocation = exports.parseDependencyLocation = exports.DependencyType = exports.TypeAnalyzerStrategy = exports.IndentationType = exports.DefaultFileExtensions = exports.ConfigurationNamespace = exports.LanguageId = void 0; exports.LanguageId = 'greyscript'; exports.ConfigurationNamespace = 'greybel'; exports.DefaultFileExtensions = ['gs', 'ms', 'src']; var IndentationType; (function (IndentationType) { IndentationType["Tab"] = "Tab"; IndentationType["Whitespace"] = "Whitespace"; })(IndentationType = exports.IndentationType || (exports.IndentationType = {})); var TypeAnalyzerStrategy; (function (TypeAnalyzerStrategy) { TypeAnalyzerStrategy["Dependency"] = "Dependency"; TypeAnalyzerStrategy["Workspace"] = "Workspace"; })(TypeAnalyzerStrategy = exports.TypeAnalyzerStrategy || (exports.TypeAnalyzerStrategy = {})); var DependencyType; (function (DependencyType) { DependencyType["Root"] = "root"; DependencyType["Include"] = "include"; DependencyType["Import"] = "import"; DependencyType["NativeImport"] = "native-import"; })(DependencyType = exports.DependencyType || (exports.DependencyType = {})); function parseDependencyLocation(location) { if (location.args && location.args.length > 0) { return `${location.type}:${location.args.join(':')}!${location.location}`; } return `${location.type}!${location.location}`; } exports.parseDependencyLocation = parseDependencyLocation; function parseDependencyRawLocation(rawLocation) { const typeIndex = rawLocation.indexOf('!'); const [type, ...args] = rawLocation.substring(0, typeIndex).split(':'); const location = rawLocation.substring(typeIndex + 1); return { type: type, location, args }; } exports.parseDependencyRawLocation = parseDependencyRawLocation; function getAllDependencyLocationsFromGraph(node, visited = new Set()) { const result = []; const queue = [...node.children]; while (queue.length > 0) { const current = queue.pop(); if (visited.has(current.item.document.textDocument.uri)) { continue; } visited.add(current.item.document.textDocument.uri); result.push(current.item.document); queue.push(...current.children); } return result; } exports.getAllDependencyLocationsFromGraph = getAllDependencyLocationsFromGraph; //# sourceMappingURL=types.js.map