Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikMennen committed Nov 19, 2023
1 parent ebf23b5 commit b9742dd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/OneWare.Verilog/TypeAssistanceVerilog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ public override async Task<List<CompletionData>> GetCustomCompletionItemsAsync()
var items = new List<CompletionData>();

var text = Editor.CurrentDocument.Text;
var usedWords = await Task.Run(() => _usedWordsRegex.Matches(text));
var usedWords = await Task.Run(() => _usedWordsRegex.Matches(text).Select(x => x.ToString()).Distinct());

foreach (var word in usedWords)
{
if(word.ToString() is { } s)
items.Add(new CompletionData(s, s, "Used word in document", TypeAssistanceIconStore.Instance.Icons[CompletionItemKind.Snippet], 0, CodeBox.CaretOffset));
items.Add(new CompletionData(word, word, "Used word in document", TypeAssistanceIconStore.Instance.Icons[CompletionItemKind.Snippet], 0, CodeBox.CaretOffset));
}

return items;
Expand All @@ -41,7 +40,7 @@ public override void TypeAssistance(TextInputEventArgs e)
if ((e.Text?.Contains(';') ?? false) && Service.IsLanguageServiceReady)
{
var line = CodeBox.Document.GetLineByOffset(CodeBox.CaretOffset).LineNumber;
AutoIndent(line, line);
//AutoIndent(line, line);
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/OneWare.Vhdl/TypeAssistanceVhdl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public override async Task<List<CompletionData>> GetCustomCompletionItemsAsync()
var items = new List<CompletionData>();

var text = Editor.CurrentDocument.Text;
var usedWords = await Task.Run(() => _usedWordsRegex.Matches(text).Select(x => x.ToString()).Distinct());

items.Add(new CompletionData("library IEEE;\nuse IEEE.std_logic_1164.all;\nuse IEEE.numeric_std.all; ",
"ieee", "IEEE Standard Packages",
Expand All @@ -39,6 +38,8 @@ public override async Task<List<CompletionData>> GetCustomCompletionItemsAsync()
Path.GetFileNameWithoutExtension(Editor.CurrentFile.Header) + ";", "entity", "Entity Declaration",
TypeAssistanceIconStore.Instance.Icons[CompletionItemKind.Class], 0, CodeBox.CaretOffset));

var usedWords = await Task.Run(() => _usedWordsRegex.Matches(text).Select(x => x.ToString()).Distinct());

foreach (var word in usedWords)
{
items.Add(new CompletionData(word, word, "Used word in document", TypeAssistanceIconStore.Instance.Icons[CompletionItemKind.Snippet], 0, CodeBox.CaretOffset));
Expand Down

0 comments on commit b9742dd

Please sign in to comment.