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

feat: LSP path completion #5712

Merged
merged 37 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
8a82d54
Start autocompleting paths
asterite Aug 11, 2024
136d882
Autocomplete with local variables too
asterite Aug 11, 2024
c4f683d
Include function params for local variables completion
asterite Aug 11, 2024
6163a0e
Collect in all pattern kinds
asterite Aug 11, 2024
b07e642
Complete functions as snippets
asterite Aug 11, 2024
711f177
Suggest predefined functions too
asterite Aug 11, 2024
aa14ff8
Show description for predefined functions
asterite Aug 11, 2024
3be936c
Remove " -> ()" suffix from function signatures
asterite Aug 11, 2024
3bfadaf
Find inside function in impl and trait impl
asterite Aug 11, 2024
63ad2b8
Traverse the entire AST
asterite Aug 11, 2024
c924fb3
Make sure lambda arguments and for index are suggested
asterite Aug 11, 2024
c066e9a
Clean up some todo!()
asterite Aug 11, 2024
05e5e65
Only suggest types at type position
asterite Aug 11, 2024
44ab749
Complete types in more places
asterite Aug 11, 2024
4d8c111
A couple more places
asterite Aug 11, 2024
ce00171
Suggest built-in types too
asterite Aug 11, 2024
f41b0ff
Better names
asterite Aug 11, 2024
0703cad
Also suggest true and false
asterite Aug 11, 2024
284a11c
Correctly handle if scope
asterite Aug 12, 2024
0c23aa5
Correctly handle block scope
asterite Aug 12, 2024
5012248
Suggest type parameters in more places
asterite Aug 12, 2024
533ec03
Add some comments
asterite Aug 12, 2024
e256942
predefined -> builtin
asterite Aug 12, 2024
129b952
clippy
asterite Aug 12, 2024
5c9910c
Fix some tests
asterite Aug 12, 2024
5e2ba4a
Fix type parameters being cleared by function
asterite Aug 12, 2024
c1addbc
Collect trait function generics
asterite Aug 12, 2024
c42b9fd
Simplify by not returning Option all the time
asterite Aug 12, 2024
d4b1814
Don't look past the cursor's position
asterite Aug 12, 2024
b85b889
clippy
asterite Aug 12, 2024
b17aa77
More clippy
asterite Aug 12, 2024
9594954
Fix if-else
asterite Aug 12, 2024
a33d7c2
Suggest assert and assert_eq overloads
asterite Aug 12, 2024
65efca8
Dehardcode a bit the list of built-in types
asterite Aug 12, 2024
6034099
Move functions to lsp
asterite Aug 12, 2024
00acd4a
Extract `builtin_values_completion`
asterite Aug 12, 2024
c4119b4
Dehardcode built-in functions
asterite Aug 12, 2024
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions compiler/noirc_frontend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ tracing.workspace = true
petgraph = "0.6"
rangemap = "1.4.0"
lalrpop-util = { version = "0.20.2", features = ["lexer"] }
strum = "0.24"
strum_macros = "0.24"


[dev-dependencies]
base64.workspace = true
strum = "0.24"
strum_macros = "0.24"

[build-dependencies]
lalrpop = "0.20.2"
Expand Down
2 changes: 1 addition & 1 deletion compiler/noirc_frontend/src/hir/def_map/module_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl ModuleData {
}
}

pub(crate) fn scope(&self) -> &ItemScope {
pub fn scope(&self) -> &ItemScope {
&self.scope
}

Expand Down
3 changes: 1 addition & 2 deletions compiler/noirc_frontend/src/lexer/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -883,8 +883,7 @@ impl AsRef<str> for SecondaryAttribute {

/// Note that `self` is not present - it is a contextual keyword rather than a true one as it is
/// only special within `impl`s. Otherwise `self` functions as a normal identifier.
#[derive(PartialEq, Eq, Hash, Debug, Copy, Clone, PartialOrd, Ord)]
#[cfg_attr(test, derive(strum_macros::EnumIter))]
#[derive(PartialEq, Eq, Hash, Debug, Copy, Clone, PartialOrd, Ord, strum_macros::EnumIter)]
pub enum Keyword {
As,
Assert,
Expand Down
1 change: 1 addition & 0 deletions tooling/lsp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ noirc_frontend.workspace = true
noirc_artifacts.workspace = true
serde.workspace = true
serde_json.workspace = true
strum = "0.24"
tower.workspace = true
async-lsp = { workspace = true, features = ["omni-trait"] }
serde_with = "3.2.0"
Expand Down
Loading
Loading