diff --git a/src/languageFeatures.ts b/src/languageFeatures.ts index 2ecc94d..d649d8c 100644 --- a/src/languageFeatures.ts +++ b/src/languageFeatures.ts @@ -1,7 +1,5 @@ import type { ParseError } from 'dt-sql-parser'; -import { - EntityContext, -} from 'dt-sql-parser/dist/parser/common/entityCollector'; +import { EntityContext } from 'dt-sql-parser/dist/parser/common/entityCollector'; import { WordPosition } from 'dt-sql-parser/dist/parser/common/textAndWord'; import * as monaco from 'monaco-editor'; @@ -15,7 +13,7 @@ import { MarkerSeverity, Position, Range, - Uri, + Uri } from './fillers/monaco-editor-core'; import type { LanguageServiceDefaults } from './monaco.contribution'; @@ -236,13 +234,17 @@ export class DefinitionAdapter implements languages.Def }; const curEntity = entities?.find((entity: EntityContext) => { const entityPosition = entity.position; - if (entityPosition.startColumn === word?.startColumn && entityPosition.endColumn === word?.endColumn && entityPosition.line === position.lineNumber) { + if ( + entityPosition.startColumn === word?.startColumn && + entityPosition.endColumn === word?.endColumn && + entityPosition.line === position.lineNumber + ) { return entity; } return null; - }) + }); if (curEntity) { - for(let k in entities) { + for (let k in entities) { const entity = entities[Number(k)]; if ( entity.entityContextType.includes('Create') && @@ -297,14 +299,22 @@ export class ReferenceAdapter implements languages.Refe const arr: languages.Location[] = []; const curEntity = entities?.find((entity: EntityContext) => { const entityPosition = entity.position; - if (entityPosition.startColumn === word?.startColumn && entityPosition.endColumn === word?.endColumn && entityPosition.line === position.lineNumber) { + if ( + entityPosition.startColumn === word?.startColumn && + entityPosition.endColumn === word?.endColumn && + entityPosition.line === position.lineNumber + ) { return entity; } return null; - }) + }); if (curEntity) { entities?.forEach((entity) => { - if (word?.word && entity.text === word?.word && curEntity.entityContextType.includes(entity.entityContextType)) { + if ( + word?.word && + entity.text === word?.word && + curEntity.entityContextType.includes(entity.entityContextType) + ) { let pos: WordPosition | null = null; pos = entity.position; arr.push({ @@ -318,7 +328,6 @@ export class ReferenceAdapter implements languages.Refe }); } }); - } return arr; });