Skip to content

Commit ca58c3a

Browse files
authored
Merge pull request #43 from pascalfoerster/issue_#37
add minor completions #37
2 parents 1a693cb + 913190a commit ca58c3a

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

uvls/src/ide/completion.rs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ impl From<Type> for CompletionKind {
519519
fn from(s: Type) -> Self {
520520
match s {
521521
Type::Bool => Self::Feature,
522-
Type::String => Self::AttributeNumber,
522+
Type::String => Self::Feature,
523523
Type::Namespace => Self::Import,
524524
Type::Real => Self::AttributeNumber,
525525
Type::Attributes => Self::AttributeAttributes,
@@ -941,18 +941,19 @@ fn compute_completions_impl(
941941
//heuristic to provide nearly correct predictions, to
942942
//make it more accurate we need to respect
943943
//parenthesis
944-
(CompletionEnv::Feature, CompletionOffset::SameLine) => {
945-
add_keywords(&ctx.postfix, &mut top, 2.0, ["cardinality".into()]);
946-
}
947-
948-
(CompletionEnv::Feature, CompletionOffset::Cut) => {
949-
add_keywords(
950-
&ctx.postfix,
951-
&mut top,
952-
2.0,
953-
["Integer".into(), "String".into(), "Real".into()],
954-
);
955-
completion_symbol(&snapshot, origin, &ctx, &mut top);
944+
(CompletionEnv::Feature, offset) => {
945+
if matches!(offset, CompletionOffset::SameLine | CompletionOffset::Continuous) {
946+
add_keywords(&ctx.postfix, &mut top, 2.0, ["cardinality".into()]);
947+
}
948+
if matches!(offset, CompletionOffset::Continuous | CompletionOffset::Cut) {
949+
add_keywords(
950+
&ctx.postfix,
951+
&mut top,
952+
2.0,
953+
["Integer".into(), "String".into(), "Real".into()],
954+
);
955+
completion_symbol(&snapshot, origin, &ctx, &mut top);
956+
}
956957
}
957958
(
958959
CompletionEnv::Constraint | CompletionEnv::Numeric,

0 commit comments

Comments
 (0)