Repository navigation
Suggest predicates that shapes require first - #40
Merged
Merged
Conversation
At a predicate position, a predicate that a SHACL property shape requires (`sh:minCount >= 1`) and that the subject does not have yet is now the first suggestion, followed by the alternatives of a required `sh:alternativePath` none of which the subject has. This holds whether the suggestion comes from the shapes or from an ontology. Such items are marked "required by shape" or "one of required by shape"; an ontology suggestion keeps its title after the marker. Predicates the subject already has are not promoted. Before, required predicates only got a "required by shape" label and were sorted alphabetically among the domain-matching properties, and required predicates that an ontology also defined were not ranked at all. Completions are now sorted the way LSP clients sort them, by sort text or else by label (`completion::sort_completions`, used by the server). Sorting by `Option<sort_text>` put every item without a sort text, such as prefix suggestions, first.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
At a predicate position, predicates that SHACL shapes require and the subject does not have yet are now at the top of the suggestions.
Ranking
sh:minCount >= 1) and the subject does not have yet comes first.sh:alternativePathwhen the subject has none of them.Before, required predicates only got a "required by shape" label and were sorted alphabetically among the domain-matching properties. Required predicates that an ontology also defined were not ranked at all.
Sorting
Completions are now sorted the way LSP clients sort them: by sort text, or by label when an item has none (
completion::sort_completions, used by the server). Sorting byOption<sort_text>put every item without a sort text first, e.g. the prefix suggestionsfoaf,owl,rdfs,rdf.Testing
e2e/tests/required_first.rs:cargo test --workspace(579 tests),cargo fmt --all --checkandcargo clippy --workspace --all-targets -- -D warnings(Rust 1.100) pass.rml:TriplesMap, the first suggestions are nowrml:logicalSource(required), thenrml:quotedTriplesMap,rml:subjectandrml:subjectMap(one of required), then the two shape templates.