Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tsunkaraneni/module file completion #1236

Merged
merged 37 commits into from
Jan 28, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
7c797a4
Intellisense support for module names. Pending testing
TSunny007 Dec 24, 2020
05d8f02
switched to text replacement
TSunny007 Dec 28, 2020
14b1a76
Merge branch 'main' of https://github.com/Azure/bicep into tsunkarane…
TSunny007 Dec 28, 2020
9b1c05b
Merge branch 'tsunkaraneni/ModuleFileCompletion' of https://github.co…
Dec 30, 2020
80066fa
File path normalization on windows
Dec 30, 2020
13cafcc
Merge branch 'main' of https://github.com/Azure/bicep into tsunkarane…
Jan 3, 2021
86190bf
Merge branch 'main' of https://github.com/Azure/bicep into tsunkarane…
Jan 5, 2021
fc4354c
Merge branch 'main' of https://github.com/Azure/bicep into tsunkarane…
Jan 7, 2021
855eeaa
Merge branch 'main' of https://github.com/Azure/bicep into tsunkarane…
Jan 7, 2021
6db3f8f
This'll fail because i don't know how to use completionItems but plz …
Jan 7, 2021
aec7ea1
update
Jan 9, 2021
b4f502e
Merge branch 'main' of https://github.com/Azure/bicep into tsunkarane…
TSunny007 Jan 9, 2021
7ae8f5e
Merge branch 'main' of https://github.com/Azure/bicep into tsunkarane…
Jan 9, 2021
95e98b1
dir exists for inMemoryFileResolver
Jan 9, 2021
ddde766
Merge branch 'tsunkaraneni/ModuleFileCompletion' of https://github.co…
TSunny007 Jan 10, 2021
c5f2e1b
Removed test dependency on a transient folder
TSunny007 Jan 10, 2021
8a7583a
Removing problematic tests
Jan 12, 2021
94d8e1e
Merge branch 'main' of https://github.com/Azure/bicep into tsunkarane…
Jan 12, 2021
adb20e9
Merge branch 'main' of https://github.com/Azure/bicep into tsunkarane…
Jan 13, 2021
4439bce
Remove exception handling from FileResolver
Jan 13, 2021
b81c761
comment nit
Jan 13, 2021
b49dbc4
removed submodule reference
Jan 13, 2021
280ae25
Merge branch 'main' of https://github.com/Azure/bicep into tsunkarane…
TSunny007 Jan 15, 2021
4826894
progress on feedback
TSunny007 Jan 16, 2021
7dcc6d7
Merge branch 'main' of https://github.com/Azure/bicep into tsunkarane…
Jan 20, 2021
d2cbc2c
Merge branch 'main' of https://github.com/Azure/bicep into tsunkarane…
Jan 20, 2021
a808b66
Does this pass?
Jan 21, 2021
d751bed
Merge branch 'main' of https://github.com/Azure/bicep into tsunkarane…
Jan 25, 2021
48d566a
make tests pass
Jan 25, 2021
ff2f8ed
regex fix
Jan 25, 2021
4c76606
Added Integration tests
Jan 25, 2021
c468a20
Add AllowDerivedTypes flag
Jan 25, 2021
7612dba
Merge branch 'main' of https://github.com/Azure/bicep into tsunkarane…
Jan 27, 2021
48df020
Chain triggering completions and snippet completions
Jan 27, 2021
1ae4183
removed unnecessary comments.
Jan 28, 2021
38f90fd
Don't show current file in completions
Jan 28, 2021
070f087
Extracting file extension as a var
Jan 28, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions src/Bicep.Core.Samples/Files/Completions/cwdMCompletions.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,6 @@
"newText": "'empty.bicep'"
}
},
{
"label": "main.bicep",
"kind": "file",
"deprecated": false,
"preselect": false,
"sortText": "1_main.bicep",
"filterText": "'main.bicep'",
"insertTextFormat": "plainText",
"insertTextMode": "asIs",
"textEdit": {
"range": {},
"newText": "'main.bicep'"
}
},
{
"label": "main.diagnostics.bicep",
"kind": "file",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,6 @@
"newText": "'empty.bicep'"
}
},
{
"label": "main.bicep",
"kind": "file",
"deprecated": false,
"preselect": false,
"sortText": "1_main.bicep",
"filterText": "'main.bicep'",
"insertTextFormat": "plainText",
"insertTextMode": "asIs",
"textEdit": {
"range": {},
"newText": "'main.bicep'"
}
},
{
"label": "main.diagnostics.bicep",
"kind": "file",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,6 @@
"newText": "'empty.bicep'"
}
},
{
"label": "main.bicep",
"kind": "file",
"deprecated": false,
"preselect": false,
"sortText": "1_main.bicep",
"filterText": "'main.bicep'",
"insertTextFormat": "plainText",
"insertTextMode": "asIs",
"textEdit": {
"range": {},
"newText": "'main.bicep'"
}
},
{
"label": "main.diagnostics.bicep",
"kind": "file",
Expand Down
15 changes: 8 additions & 7 deletions src/Bicep.LangServer/Completions/BicepCompletionProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,21 +217,22 @@ private IEnumerable<CompletionItem> GetModulePathCompletions(SemanticModel model
// "./" will not be preserved when making relative Uris. We have to go and manually add it.
// Prioritize .bicep files higher than other files.
var fileItems = files
.Where(file => file.Segments.Last().EndsWith(LanguageServerConstants.LanguageId))
.Where(file => file != model.SyntaxTree.FileUri)
.Where(file => file.Segments.Last().EndsWith("." + LanguageServerConstants.LanguageId))
TSunny007 marked this conversation as resolved.
Show resolved Hide resolved
.Select(file => CreateModulePathCompletion(
file.Segments.Last(),
(entered.StartsWith("./") ? "./" : "") + cwdUri.MakeRelativeUri(file).ToString(),
context.ReplacementRange,
CompletionItemKind.File,
file.Segments.Last(),
(entered.StartsWith("./") ? "./" : "") + cwdUri.MakeRelativeUri(file).ToString(),
context.ReplacementRange,
CompletionItemKind.File,
file.Segments.Last().EndsWith(LanguageServerConstants.LanguageId) ? CompletionPriority.High : CompletionPriority.Medium))
.ToList();

var dirItems = dirs
.Select(dir => CreateModulePathCompletion(
dir.Segments.Last(),
(entered.StartsWith("./") ? "./" : "") + cwdUri.MakeRelativeUri(dir).ToString(),
context.ReplacementRange,
CompletionItemKind.Folder,
context.ReplacementRange,
CompletionItemKind.Folder,
CompletionPriority.Medium)
.WithCommand(new Command {Name = EditorCommands.RequestCompletions }))
.ToList();
Expand Down