diff options
author | 2024-02-02 16:28:19 +0100 | |
---|---|---|
committer | 2024-02-02 17:36:24 +0100 | |
commit | 2dfcb286216419976368ad926f8ac7f018aa2bf9 (patch) | |
tree | b9d235ebf2049e42e58126e743c782333d64681a /subprojects/frontend/src/xtext/ContentAssistService.ts | |
parent | refactor: serialize solutions as modules (diff) | |
download | refinery-2dfcb286216419976368ad926f8ac7f018aa2bf9.tar.gz refinery-2dfcb286216419976368ad926f8ac7f018aa2bf9.tar.zst refinery-2dfcb286216419976368ad926f8ac7f018aa2bf9.zip |
refactor(language): name disambiguation
* Use fully qualified names starting with :: (as in C++) to unambiguously refer
to an element.
* Name shadowing within modules.
Diffstat (limited to 'subprojects/frontend/src/xtext/ContentAssistService.ts')
-rw-r--r-- | subprojects/frontend/src/xtext/ContentAssistService.ts | 8 |
1 files changed, 6 insertions, 2 deletions
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 @@ | |||
1 | /* | 1 | /* |
2 | * SPDX-FileCopyrightText: 2021-2023 The Refinery Authors <https://refinery.tools/> | 2 | * SPDX-FileCopyrightText: 2021-2024 The Refinery Authors <https://refinery.tools/> |
3 | * | 3 | * |
4 | * SPDX-License-Identifier: EPL-2.0 | 4 | * SPDX-License-Identifier: EPL-2.0 |
5 | */ | 5 | */ |
@@ -108,7 +108,11 @@ function createCompletion(entry: ContentAssistEntry): Completion { | |||
108 | boost = -90; | 108 | boost = -90; |
109 | break; | 109 | break; |
110 | default: | 110 | default: |
111 | { | 111 | if (entry.proposal.startsWith('::')) { |
112 | // Move absolute names below relative names, | ||
113 | // they should only be preferred if no relative name is available. | ||
114 | boost = -60; | ||
115 | } else { | ||
112 | // Penalize qualified names (vs available unqualified names). | 116 | // Penalize qualified names (vs available unqualified names). |
113 | const extraSegments = entry.proposal.match(/::/g)?.length || 0; | 117 | const extraSegments = entry.proposal.match(/::/g)?.length || 0; |
114 | boost = Math.max(-5 * extraSegments, -50); | 118 | boost = Math.max(-5 * extraSegments, -50); |