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

Unit and tuple struct definitions in Rust do not appear in the outline panel #18294

Closed
1 task done
noritada opened this issue Sep 24, 2024 · 1 comment · Fixed by #18297
Closed
1 task done

Unit and tuple struct definitions in Rust do not appear in the outline panel #18294

noritada opened this issue Sep 24, 2024 · 1 comment · Fixed by #18297
Labels
bug [core label] outline Feedback for outline view, symbols, etc regression A bug that was introduced in a recent release rust Rust programming language support tree-sitter Syntax highlighting and tree-sitter

Comments

@noritada
Copy link
Contributor

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

For Rust files, although named struct definitions do appear in the outline panel, unit and tuple struct definitions do not.
Only items for struct implementations do appear.

This seems to be caused by following definition change in crates/languages/src/rust/outline.scm introduced by #16447.

 (struct_item
     (visibility_modifier)? @context
     "struct" @context
-    name: (_) @name) @item
+    name: (_) @name
+    body: (_ "{" @open (_)* "}" @close)) @item

Note: supports for unit/tuple structs seems to be tested using the original definition in crates/outline/src/outline.rs.

Environment

Zed: v0.153.7 (Zed)
OS: macOS 13.6.7
Memory: 24 GiB
Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

Screenshot:

ss 2024-09-25 2 30 21

Code used:

fn main() {
    println!("Hello, world!");
}

struct A;

impl A {}

struct B(u8);

impl B {}

struct C {
    inner: u8,
}

impl C {}

If applicable, attach your Zed.log file to this issue.

Zed.log
2024-09-25T03:09:04.775259+09:00 [INFO] building git repository, `.git` path in the worktree: ".git"
2024-09-25T03:09:04.778097+09:00 [ERROR] Error { code: -9, klass: 4, message: "reference 'refs/heads/master' not found" }
2024-09-25T03:09:04.793169+09:00 [INFO] Initializing default prettier with plugins {}
2024-09-25T03:09:04.793823+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.794016+09:00 [INFO] starting language servers for TOML: taplo
2024-09-25T03:09:04.794183+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.794357+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.794535+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.794717+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.796781+09:00 [INFO] Initializing default prettier with plugins {}
2024-09-25T03:09:04.79697+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.797991+09:00 [INFO] Initializing default prettier with plugins {}
2024-09-25T03:09:04.798213+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.798402+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.798578+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.798761+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.799523+09:00 [INFO] Initializing default prettier with plugins {}
2024-09-25T03:09:04.799736+09:00 [INFO] starting language servers for C: clangd
2024-09-25T03:09:04.799924+09:00 [INFO] starting language servers for C: clangd
2024-09-25T03:09:04.800107+09:00 [INFO] starting language servers for C: clangd
2024-09-25T03:09:04.800296+09:00 [INFO] starting language servers for Markdown: 
2024-09-25T03:09:04.800458+09:00 [INFO] starting language servers for C++: clangd
2024-09-25T03:09:04.80064+09:00 [INFO] starting language servers for C: clangd
2024-09-25T03:09:04.80085+09:00 [INFO] starting language servers for C: clangd
2024-09-25T03:09:04.801057+09:00 [INFO] starting language servers for C++: clangd
2024-09-25T03:09:04.801993+09:00 [INFO] Initializing default prettier with plugins {}
2024-09-25T03:09:04.802171+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.80234+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.802515+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.802713+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.802905+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.803069+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.803252+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.803443+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.803598+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.803755+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.803915+09:00 [INFO] starting language servers for Markdown: 
2024-09-25T03:09:04.804094+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.804257+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.804436+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.804649+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.804824+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.805067+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.805235+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.805413+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.805596+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.805812+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.80601+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.806183+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.807982+09:00 [INFO] Initializing default prettier with plugins {}
2024-09-25T03:09:04.810532+09:00 [INFO] Initializing default prettier with plugins {}
2024-09-25T03:09:04.810689+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.810879+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.811889+09:00 [INFO] Initializing default prettier with plugins {}
2024-09-25T03:09:04.812109+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.812269+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.812433+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.812626+09:00 [INFO] starting language servers for Markdown: 
2024-09-25T03:09:04.812775+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.812972+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.81313+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.813328+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.813476+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.813736+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.813897+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.814058+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.814253+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.814425+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.852199+09:00 [WARN] request completed with error: failed to connect to the server
2024-09-25T03:09:04.918036+09:00 [INFO] starting language servers for Rust: rust-analyzer
2024-09-25T03:09:04.918172+09:00 [INFO] starting language server "rust-analyzer", path: "/Users/noritada/work/lab/rust/rust-file-structure-outline", id: 13
2024-09-25T03:09:04.918345+09:00 [INFO] Initializing default prettier with plugins {}
2024-09-25T03:09:04.919169+09:00 [INFO] using CLI environment for language server "rust-analyzer", id: 13
2024-09-25T03:09:04.919322+09:00 [INFO] starting language server. binary path: "/Users/noritada/Library/Application Support/Zed/languages/rust-analyzer/rust-analyzer-2024-09-16", working directory: "/Users/noritada/work/lab/rust/rust-file-structure-outline", args: []
2024-09-25T03:09:04.922983+09:00 [ERROR] No path or contents found for buffer
2024-09-25T03:09:08.579222+09:00 [INFO] Language server with id 4 sent unhandled notification taplo/didChangeSchemaAssociation:
{
  "documentUri": "file:///Users/noritada/ghq/private/radverse/Cargo.toml",
  "schemaUri": "https://json.schemastore.org/cargo.json",
  "meta": {
    "name": "Cargo Manifest",
    "description": "Manifest for Cargo, the Rust package manager and build tool",
    "source": "catalog",
    "catalog_url": "https://www.schemastore.org/api/json/catalog.json"
  }
}
@noritada noritada added admin read Pending admin review bug [core label] triage Maintainer needs to classify the issue labels Sep 24, 2024
@notpeter notpeter added rust Rust programming language support outline Feedback for outline view, symbols, etc tree-sitter Syntax highlighting and tree-sitter regression A bug that was introduced in a recent release and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Sep 24, 2024
@maxbrunsfeld
Copy link
Collaborator

Thanks for the report @noritada. That change to the outline query should never have been committed in that PR. Sorry for the breakage.

maxbrunsfeld added a commit that referenced this issue Sep 24, 2024
Fixes #18294

Release Notes:

- Fixed a recent regression where tuple and unit structs were omitted
from the outline view in Rust (#18294).
maxbrunsfeld added a commit that referenced this issue Sep 24, 2024
Fixes #18294

Release Notes:

- Fixed a recent regression where tuple and unit structs were omitted
from the outline view in Rust (#18294).
noaccOS pushed a commit to noaccOS/zed that referenced this issue Oct 19, 2024
…industries#18297)

Fixes zed-industries#18294

Release Notes:

- Fixed a recent regression where tuple and unit structs were omitted
from the outline view in Rust (zed-industries#18294).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [core label] outline Feedback for outline view, symbols, etc regression A bug that was introduced in a recent release rust Rust programming language support tree-sitter Syntax highlighting and tree-sitter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants