From 2dfcb286216419976368ad926f8ac7f018aa2bf9 Mon Sep 17 00:00:00 2001 From: Kristóf Marussy Date: Fri, 2 Feb 2024 16:28:19 +0100 Subject: refactor(language): name disambiguation * Use fully qualified names starting with :: (as in C++) to unambiguously refer to an element. * Name shadowing within modules. --- subprojects/frontend/src/xtext/ContentAssistService.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'subprojects/frontend/src/xtext/ContentAssistService.ts') diff --git a/subprojects/frontend/src/xtext/ContentAssistService.ts b/subprojects/frontend/src/xtext/ContentAssistService.ts index ac8ab36a..d42dde14 100644 --- a/subprojects/frontend/src/xtext/ContentAssistService.ts +++ b/subprojects/frontend/src/xtext/ContentAssistService.ts @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors + * SPDX-FileCopyrightText: 2021-2024 The Refinery Authors * * SPDX-License-Identifier: EPL-2.0 */ @@ -108,7 +108,11 @@ function createCompletion(entry: ContentAssistEntry): Completion { boost = -90; break; default: - { + if (entry.proposal.startsWith('::')) { + // Move absolute names below relative names, + // they should only be preferred if no relative name is available. + boost = -60; + } else { // Penalize qualified names (vs available unqualified names). const extraSegments = entry.proposal.match(/::/g)?.length || 0; boost = Math.max(-5 * extraSegments, -50); -- cgit v1.2.3-54-g00ecf