From 4484908a867fc742104d6ffe63b865a411203276 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 30 Jun 2020 13:03:08 +0200 Subject: Rewrite goto definition tests --- docs/dev/README.md | 3 +++ 1 file changed, 3 insertions(+) (limited to 'docs/dev') diff --git a/docs/dev/README.md b/docs/dev/README.md index 6b6824ded..f1139d2f4 100644 --- a/docs/dev/README.md +++ b/docs/dev/README.md @@ -177,6 +177,9 @@ There are many benefits to this: * less stuff printed during printf-debugging * less time to run test +It also makes sense to format snippets more compactly (for example, by placing enum defitions like `enum E { Foo, Bar }` on a single line), +as long as they are still readable. + ## Order of Imports We separate import groups with blank lines -- cgit v1.2.3 From 991850bc3c2ff34fe8b3e63815067307d8d90db6 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 1 Jul 2020 12:31:03 +0200 Subject: Unify magic env var name --- docs/dev/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/dev') diff --git a/docs/dev/README.md b/docs/dev/README.md index f1139d2f4..f87462400 100644 --- a/docs/dev/README.md +++ b/docs/dev/README.md @@ -361,10 +361,10 @@ There are two kinds of tests: The purpose of inline tests is not to achieve full coverage by test cases, but to explain to the reader of the code what each particular `if` and `match` is responsible for. If you are tempted to add a large inline test, it might be a good idea to leave only the simplest example in place, and move the test to a manual `parser/ok` test. -To update test data, run with `UPDATE_EXPECTATIONS` variable: +To update test data, run with `UPDATE_EXPECT` variable: ```bash -env UPDATE_EXPECTATIONS=1 cargo qt +env UPDATE_EXPECT=1 cargo qt ``` After adding a new inline test you need to run `cargo xtest codegen` and also update the test data as described above. -- cgit v1.2.3 From c9f878962a7c9d1c33d5834a1dce2106c9286699 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 1 Jul 2020 14:57:59 +0200 Subject: Add reload workspace command --- docs/dev/lsp-extensions.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'docs/dev') diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md index a0847dad3..c0afb16d3 100644 --- a/docs/dev/lsp-extensions.md +++ b/docs/dev/lsp-extensions.md @@ -389,15 +389,15 @@ rust-analyzer supports only one `kind`, `"cargo"`. The `args` for `"cargo"` look Returns internal status message, mostly for debugging purposes. -## Collect Garbage +## Reload Workspace -**Method:** `rust-analyzer/collectGarbage` +**Method:** `rust-analyzer/reloadWorkspace` **Request:** `null` **Response:** `null` -Frees some caches. For internal use, and is mostly broken at the moment. +Reloads project information (that is, re-executes `cargo metadata`). ## Syntax Tree @@ -504,4 +504,4 @@ Such actions on the client side are appended to a hover bottom as command links: | TITLE _Action1_ | _Action2_ | <- second group +-----------------------------+ ... -``` \ No newline at end of file +``` -- cgit v1.2.3 From 3ef76760761d17cef4ea4e8462d9ee2ca8395467 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 2 Jul 2020 12:37:04 +0200 Subject: Implement StatusBar --- docs/dev/lsp-extensions.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'docs/dev') diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md index c0afb16d3..6d6bbac7c 100644 --- a/docs/dev/lsp-extensions.md +++ b/docs/dev/lsp-extensions.md @@ -399,6 +399,18 @@ Returns internal status message, mostly for debugging purposes. Reloads project information (that is, re-executes `cargo metadata`). +## Status Notification + +**Client Capability:** `{ "statusNotification": boolean }` + +**Method:** `rust-analyzer/status` + +**Notification:** `"loading" | "ready" | "invalid" | "needsReload"` + +This notification is sent from server to client. +The client can use it to display persistent status to the user (in modline). +For `needsReload` state, the client can provide a context-menu action to run `rust-analyzer/reloadWorkspace` request. + ## Syntax Tree **Method:** `rust-analyzer/syntaxTree` -- cgit v1.2.3 From 8ab0c7ffd3f976272caa65b00220d016f6018d8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Mon, 6 Jul 2020 13:59:24 +0300 Subject: Don't ping people in PRs --- docs/dev/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/dev') diff --git a/docs/dev/README.md b/docs/dev/README.md index f87462400..b6a00df18 100644 --- a/docs/dev/README.md +++ b/docs/dev/README.md @@ -314,7 +314,7 @@ We don't have specific rules around git history hygiene. Maintaining clean git history is encouraged, but not enforced. We use rebase workflow, it's OK to rewrite history during PR review process. -Avoid @mentioning people in commit messages, as such messages create a lot of duplicate notification traffic during rebases. +Avoid @mentioning people in commit messages and pull request descriptions, as such messages create a lot of duplicate notification traffic during rebases. # Architecture Invariants -- cgit v1.2.3 From c88d85bbb497ccf58faf219178ea3cb8b88d3cd5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 7 Jul 2020 11:23:59 +0200 Subject: Update docs/dev/README.md --- docs/dev/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs/dev') diff --git a/docs/dev/README.md b/docs/dev/README.md index b6a00df18..3af01cd6b 100644 --- a/docs/dev/README.md +++ b/docs/dev/README.md @@ -314,7 +314,7 @@ We don't have specific rules around git history hygiene. Maintaining clean git history is encouraged, but not enforced. We use rebase workflow, it's OK to rewrite history during PR review process. -Avoid @mentioning people in commit messages and pull request descriptions, as such messages create a lot of duplicate notification traffic during rebases. +Avoid @mentioning people in commit messages and pull request descriptions (they are added to commit message by bors), as such messages create a lot of duplicate notification traffic during rebases. # Architecture Invariants -- cgit v1.2.3 From daab8b2fd03340ea0be91281673c256b02ad8a90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Tue, 21 Jul 2020 13:11:02 +0300 Subject: Remove insta dep --- docs/dev/architecture.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'docs/dev') diff --git a/docs/dev/architecture.md b/docs/dev/architecture.md index cee916c09..d0c6eea61 100644 --- a/docs/dev/architecture.md +++ b/docs/dev/architecture.md @@ -170,8 +170,7 @@ The innermost and most elaborate boundary is `hir`. It has a much richer vocabulary of types than `ide`, but the basic testing setup is the same: we create a database, run some queries, assert result. -For comparisons, we use [insta](https://github.com/mitsuhiko/insta/) library for -snapshot testing. +For comparisons, we use the `expect` crate for snapshot testing. To test various analysis corner cases and avoid forgetting about old tests, we use so-called marks. See the `marks` module in the `test_utils` crate for more. -- cgit v1.2.3 From deed44a472edaf11d35fa98c7e68a288f8dfe93f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 22 Jul 2020 13:40:45 +0200 Subject: Remove support for jemalloc We only used it for measuring memory usage, but now we can use glibc's allocator for that just fine --- docs/dev/README.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'docs/dev') diff --git a/docs/dev/README.md b/docs/dev/README.md index 3af01cd6b..2bb2f75bd 100644 --- a/docs/dev/README.md +++ b/docs/dev/README.md @@ -397,13 +397,7 @@ To log all communication between the server and the client, there are two choice There are also two VS Code commands which might be of interest: -* `Rust Analyzer: Status` shows some memory-usage statistics. To take full - advantage of it, you need to compile rust-analyzer with jemalloc support: - ``` - $ cargo install --path crates/rust-analyzer --force --features jemalloc - ``` - - There's an alias for this: `cargo xtask install --server --jemalloc`. +* `Rust Analyzer: Status` shows some memory-usage statistics. * `Rust Analyzer: Syntax Tree` shows syntax tree of the current file/selection. -- cgit v1.2.3 From 9c0ead30b97ddb9784b20c06aebd2fbf0187a106 Mon Sep 17 00:00:00 2001 From: Jeremy Kolb Date: Wed, 22 Jul 2020 10:05:36 -0400 Subject: Clarify initializationOptions --- docs/dev/lsp-extensions.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'docs/dev') diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md index 6d6bbac7c..98d14450b 100644 --- a/docs/dev/lsp-extensions.md +++ b/docs/dev/lsp-extensions.md @@ -11,11 +11,13 @@ If you want to be notified about the changes to this document, subscribe to [#46 ## `initializationOptions` -As `initializationOptions`, `rust-analyzer` expects `"rust-analyzer"` section of the configuration. +For `initializationOptions`, `rust-analyzer` expects `"rust-analyzer"` section of the configuration. That is, `rust-analyzer` usually sends `"workspace/configuration"` request with `{ "items": ["rust-analyzer"] }` payload. `initializationOptions` should contain the same data that would be in the first item of the result. -It's OK to not send anything, then all the settings would take their default values. -However, some settings can not be changed after startup at the moment. +If a language client does not know about `rust-analyzer`'s configuration options it can get sensible defaults by doing any of the following: + * Not sending `initializationOptions` + * Send `"initializationOptions": null` + * Send `"initializationOptions": {}` ## Snippet `TextEdit` -- cgit v1.2.3 From 3975952601888d9f77e466c12e8e389748984b33 Mon Sep 17 00:00:00 2001 From: David Lattimore Date: Wed, 22 Jul 2020 15:00:28 +1000 Subject: SSR: Pass current file position through to SSR code. In a subsequent commit, it will be used for resolving paths. --- docs/dev/lsp-extensions.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'docs/dev') diff --git a/docs/dev/lsp-extensions.md b/docs/dev/lsp-extensions.md index 98d14450b..1be01fd88 100644 --- a/docs/dev/lsp-extensions.md +++ b/docs/dev/lsp-extensions.md @@ -274,6 +274,11 @@ interface SsrParams { query: string, /// If true, only check the syntax of the query and don't compute the actual edit. parseOnly: bool, + /// The current text document. This and `position` will be used to determine in what scope + /// paths in `query` should be resolved. + textDocument: lc.TextDocumentIdentifier; + /// Position where SSR was invoked. + position: lc.Position; } ``` @@ -285,7 +290,7 @@ WorkspaceEdit ### Example -SSR with query `foo($a:expr, $b:expr) ==>> ($a).foo($b)` will transform, eg `foo(y + 5, z)` into `(y + 5).foo(z)`. +SSR with query `foo($a, $b) ==>> ($a).foo($b)` will transform, eg `foo(y + 5, z)` into `(y + 5).foo(z)`. ### Unresolved Question -- cgit v1.2.3 From 7d80a49e8956d13151b7db2d15b779e4015f25db Mon Sep 17 00:00:00 2001 From: David Lattimore Date: Sat, 25 Jul 2020 09:35:33 +1000 Subject: README: Add some instructions for running typescript tests and linter. --- docs/dev/README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'docs/dev') diff --git a/docs/dev/README.md b/docs/dev/README.md index 2bb2f75bd..417352c9d 100644 --- a/docs/dev/README.md +++ b/docs/dev/README.md @@ -369,6 +369,16 @@ env UPDATE_EXPECT=1 cargo qt After adding a new inline test you need to run `cargo xtest codegen` and also update the test data as described above. +## TypeScript Tests + +If you change files under `editors/code` and would like to run the tests and linter, install npm and run: + +```bash +cd editors/code +npm ci +npm run lint +``` + # Logging Logging is done by both rust-analyzer and VS Code, so it might be tricky to -- cgit v1.2.3 From 1142112c70b705f59b7d559d9d72cdc831865158 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 14:51:08 +0200 Subject: Rename FnDef -> Fn --- docs/dev/syntax.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs/dev') diff --git a/docs/dev/syntax.md b/docs/dev/syntax.md index c2864bbbc..d4bc4b07c 100644 --- a/docs/dev/syntax.md +++ b/docs/dev/syntax.md @@ -82,7 +82,7 @@ Points of note: An input like `fn f() { 90 + 2 }` might be parsed as ``` -FN_DEF@0..17 +FN@0..17 FN_KW@0..2 "fn" WHITESPACE@2..3 " " NAME@3..4 @@ -342,7 +342,7 @@ pub struct FnDef { impl AstNode for FnDef { fn cast(syntax: SyntaxNode) -> Option { match kind { - FN_DEF => Some(FnDef { syntax }), + FN => Some(FnDef { syntax }), _ => None, } } -- cgit v1.2.3