Skip to content

Commit

Permalink
[LS] Ajout des description à tous les types
Browse files Browse the repository at this point in the history
  • Loading branch information
gideruette committed Sep 2, 2024
1 parent 5c53e79 commit 9bef8dd
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions TopModel.LanguageServer/CompletionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ private CompletionList CompleteClass(CompletionParams request, ModelFile file, i
{
Kind = CompletionItemKind.Class,
Label = availableClasses.Contains(classe) ? classe.Name : $"{classe.Name} - ({classe.ModelFile.Name})",
LabelDetails = new()
{
Description = $"{classe.Comment}"
},
InsertText = classe.Name,
SortText = availableClasses.Contains(classe) ? "0000" + classe.Name : classe.Name,
TextEdit = new TextEditOrInsertReplaceEdit(new TextEdit
Expand Down Expand Up @@ -197,6 +201,10 @@ private CompletionList CompleteDecorator(CompletionParams request, ModelFile fil
{
Kind = CompletionItemKind.Class,
Label = availableDecorators.Contains(decorator) ? decorator.Name : $"{decorator.Name} - ({decorator.ModelFile.Name})",
LabelDetails = new()
{
Description = $"{decorator.Description}"
},
InsertText = decorator.Name,
SortText = availableDecorators.Contains(decorator) ? "0000" + decorator.Name : decorator.Name,
TextEdit = new TextEditOrInsertReplaceEdit(new TextEdit
Expand All @@ -219,16 +227,19 @@ private CompletionList CompleteDomain(CompletionParams request)
var searchText = GetSearchText(request);
return new CompletionList(
_modelStore.Domains
.Select(domain => domain.Key)
.Where(domain => domain.ToLower().ShouldMatch(searchText))
.Where(domain => domain.Key.ToLower().ShouldMatch(searchText))
.OrderBy(domain => domain)
.Select(domain => new CompletionItem
{
Kind = CompletionItemKind.EnumMember,
Label = domain,
Label = domain.Key,
LabelDetails = new()
{
Description = $"{domain.Value.Label}"
},
TextEdit = new TextEditOrInsertReplaceEdit(new TextEdit
{
NewText = domain,
NewText = domain.Key,
Range = GetCompleteRange(searchText, request)
}),
}));
Expand Down

0 comments on commit 9bef8dd

Please sign in to comment.