profile
viewpoint
Zac Pullar-Strecker zacps @catalyst Auckland Undergraduate at Auckland University. Alacritty Contributor.

zacps/blocked 33

A proc-macro that checks if blockers (issues) have been resolved.

zacps/alacritty 9

A cross-platform, GPU-accelerated terminal emulator

zacps/Air-for-steam-Auto-updater 3

Auto-updater for the Air skin for steam. Written in python

alacritty/winpty 2

Rust bindings for the Windows WinPTY backend

catalyst/rpinz 2

Raspberry Pi New Zealand

catalyst/django-oidc-provider 1

OpenID Connect and OAuth2 provider implementation for Djangonauts.

zacps/actix-broker 0

Message broker for the Actix actor framework

zacps/actix-web 0

Actix web is a small, pragmatic, and extremely fast rust web framework.

zacps/anyhow 0

Flexible concrete Error type built on std::error::Error

PR opened zacps/zip-rs

Async attempt2
+1361 -180

0 comment

21 changed files

pr created time in 2 days

issue commentmicrosoft/vscode

Add a url scheme or other mechanism to allow opening file URLs in Hover/Completion/... in the default program

I want the file URL to be opened in whatever application the system has bound for that URL. In the case of an HTML file this is likely a browser.

zacps

comment created time in 2 days

pull request commentrust-analyzer/rust-analyzer

Local doc resolving

That is also something I want to add. I didn't add link rewriting completion docs to the initial PR because there's an existing Docs type with a 'should be refactored' note. I wasn't sure exactly how it should be integrated.

zacps

comment created time in 2 days

issue openedtokio-rs/tokio

Fails to compile with the minimum supported rust version (1.39)

Version 0.3.1

Platform ubuntu-latest

Description Compiling using the minimum supported rust version, 1.39 fails:

   Compiling tokio v0.3.1
error: cannot find macro `matches` in this scope
Error:   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.3.1/src/runtime/task/error.rs:53:9
   |
53 |         matches!(&self.repr, Repr::Panic(_))
   |         ^^^^^^^

error: cannot find macro `matches` in this scope
Error:   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.3.1/src/runtime/task/error.rs:33:9
   |
33 |         matches!(&self.repr, Repr::Cancelled)
   |         ^^^^^^^

error: cannot find macro `matches` in this scope
Error:   --> /home/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.3.1/src/runtime/enter.rs:16:9
   |
16 |         matches!(self, EnterContext::Entered { .. })
   |         ^^^^^^^

Because tokio now uses the matches macro which was only introduced in 1.42.0.

created time in 3 days

push eventzacps/zip-rs

Zac Pullar-Strecker

commit sha 7130cb2af14ffc4d0ce702b772e4a5fa620aa841

Remove drop on AsyncZipFile I think documenting that the file must be read til the end before the reader can be reused is a reasonable comprimise until we have async destructors. Once they arrive we can reinstate drop, but for the moment it's not worth passing through an executor.

view details

Zac Pullar-Strecker

commit sha 6f03ce6d5367f6894f438609fa2557c8aaf35d81

Enable async feature in CI (tests)

view details

push time in 3 days

push eventzacps/zip-rs

Zac Pullar-Strecker

commit sha 44286b2966419293e46364beeee530bff7cfc5b7

Remove Pin from the public API

view details

push time in 3 days

PR opened rust-analyzer/rust-analyzer

Local doc resolving

Very work in progress.

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6332

+85 -18

0 comment

6 changed files

pr created time in 3 days

create barnchzacps/rust-analyzer

branch : local-doc-resolving

created branch time in 3 days

push eventzacps/zip-rs

Zac Pullar-Strecker

commit sha f781d7bb5a034b06fd34f2e5ad1d48d20d65d24a

Add async tests

view details

push time in 4 days

push eventzacps/zip-rs

Zac Pullar-Strecker

commit sha 47e5a4b86e87197e74f995c1013feba8d5a14467

Add async tests

view details

push time in 4 days

pull request commentzip-rs/zip

Async support

Current state:

  • A number of tests copied over from sync code pass

  • The drop implementation on AsyncZipFile is broken because of https://github.com/rust-lang/futures-rs/issues/2090

    I think the best approach might be to get rid of the drop implementation entirely, make AsyncZipFile must_use and add an explicit async .close() method. This would get around the problem of having to specify an executor and means we don't block the thread in the case where the underlying reader is slow (i.e. network storage).

    Spinning might be another option, especially if just seeking to the end of the file was an option, why is read used in the existing implementation?

  • The external API requires wrapping AsyncZipFile in Pin<&mut ...> in order to call any methods, should be able to deal with it by moving the pin inside the struct.

zacps

comment created time in 4 days

push eventzacps/zip-rs

Zac Pullar-Strecker

commit sha bcb3e54ed1576078b4a9c912c2f1d003eef4e96a

Make Compat pub(crate)

view details

Zac Pullar-Strecker

commit sha 0db5741f42b23ddd3fecca68a9c7bf905b55afb8

Add async tests

view details

push time in 4 days

push eventzacps/zip-rs

Zac Pullar-Strecker

commit sha 041cc3a3296a2dc24a83d9209af73f2ab1bdf44b

Fix asyncread compat

view details

push time in 4 days

push eventzacps/zip-rs

Zac Pullar-Strecker

commit sha c8fc8058c42954b7143851761e3530cd28363edf

Bump minimum rust version for async/await

view details

push time in 4 days

push eventzacps/zip-rs

Zac Pullar-Strecker

commit sha 30d1092a4ef29822b56591d8750256cb630058ac

Implement all the things

view details

push time in 4 days

push eventzacps/zip-rs

Zac Pullar-Strecker

commit sha 54602cd2382e7d69bfd972ac50b0dcc1e8b5055d

Implement all the things

view details

push time in 4 days

push eventzacps/zip-rs

Zac Pullar-Strecker

commit sha ccd8b6c26151d0a2b3679a7da1c1a32eddd3e4ac

Impl AsyncRead for AsyncZipFile

view details

Zac Pullar-Strecker

commit sha d618bf6857d74df9c33049d0bfb3766a8c32f3fc

Add missing feature gates

view details

push time in 4 days

issue commentmicrosoft/vscode

Add a url scheme or other mechanism to allow opening file URLs in Hover/Completion/... in the default program

I've described a possible workaround using command URLs here

zacps

comment created time in 4 days

push eventzacps/zip-rs

Zac Pullar-Strecker

commit sha 5a7c8997d04866fa4209bde3b5ece70b7163a78b

It compiles!

view details

push time in 4 days

PR opened zip-rs/zip

Async support

Very work in progress (i.e. does not yet compile).

Fixes https://github.com/zip-rs/zip/issues/124

+853 -7

0 comment

7 changed files

pr created time in 4 days

create barnchzacps/zip-rs

branch : async-attempt2

created branch time in 4 days

issue commentrust-analyzer/rust-analyzer

Add support for resolving documentation links to local documentation

To expand on the trampoline:

Currently if we include a file:// URL in a hover vscode will open the file when it's clicked on and we can't change that. Viewing the generated HTML docs in the editor is almost certainly not intended.

Instead we'll generate the local URL as normal on the server, then the client will rewrite it to a command URL encoding the actual filepath as JSON.

That will trigger a command on the client which can unpack the JSON to get the URL and then use the system's default application (hopefully a browser) to open the path.

Messy, but it should work.

Meanwhile, other clients which open file URLs outside of the editor by default need to do none of this work as they'll just get the normal URL.

zacps

comment created time in 6 days

issue openedrust-analyzer/rust-analyzer

Add support for resolving documentation links to local documentation

This will consist of a few separate changes:

  • Add a setting for changing between remote and local resolution
  • Add the actual logic for resolving links (and bare definitions for the open docs command) to local documentation
  • Add a clientside trampoline so that file:// URLs can be opened with a browser instead of in the editor

created time in 6 days

PR opened rust-analyzer/rust-analyzer

Fix opening module documentation opening parent documentation instead

The whole path/URL joining code is kind of ugly which is what led to this, but at the same time I don't really want to rewrite it right now...

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6286

+24 -4

0 comment

1 changed file

pr created time in 7 days

push eventzacps/rust-analyzer

Zac Pullar-Strecker

commit sha 68c67efa683bd676096c3a28960f806d4d3dc5d7

Fix opening module documentation opening parent documentation instead The whole path/URL joining code is kind of ugly which is what led to this, but at the same time I don't really want to rewrite it right now...

view details

push time in 7 days

create barnchzacps/rust-analyzer

branch : 6286-open-module-documentation

created branch time in 7 days

issue commentrust-analyzer/rust-analyzer

Opening Documentation for module opens parent module

Cheers for the report, I'll try to take a look at it sometime this week.

CryZe

comment created time in 8 days

issue openedmicrosoft/vscode

Add a url scheme or other mechanism to allow opening file URLs in Hover/Completion/... in the default program

<!-- ⚠️⚠️ Do Not Delete This! feature_request_template ⚠️⚠️ --> <!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ --> <!-- Please search existing issues to avoid creating duplicates. -->

<!-- Describe the feature you'd like. --> Currently markdown hovers or completion popups can contain clickable links. rust-analyzer has recently started resolving links in documentation to point at their hosted documentation. However, the program which generates documentation for Rust can also create local documentation files (html).

We want the user to be able to chose whether these links resolve to hosted documentation or local documentation. Unfortunately, when a hover contains a file:// URL it is intercepted by vs code and not opened in a browser.

A simple way to resolve this would be to add handling for a specific scheme, for example extfile://, which rewrites to file:// and defers to the OS.

created time in 8 days

issue commentrust-lang/miri

Building a REPL on top of miri

What's the current status of this? Has it been superseded by the possibility of a cranelift backend?

oli-obk

comment created time in 13 days

startedvscode-org-mode/vscode-org-mode

started time in 17 days

startedCWood1/cargo-junit

started time in 18 days

pull request commentrust-analyzer/rust-analyzer

Add a command to open docs for the symbol under the cursor

@matklad I've removed MethodOwner

I think this is probably ready now?

zacps

comment created time in 21 days

push eventzacps/rust-analyzer

Zac Pullar-Strecker

commit sha 3bd4fe96dce17eb2bff380389b24ea325bf54803

Remove methodowner & fix formatting

view details

push time in 21 days

push eventzacps/rust-analyzer

Zac Pullar-Strecker

commit sha dfde80ed8b5ccb1136a99fd44b6331451a5d42d8

Remove methodowner & fix formatting

view details

push time in 21 days

push eventzacps/rust-analyzer

adamrk

commit sha c6ddb907144688ae77a6de3666159feef53638e1

Add references to fn args during completion

view details

dragfire

commit sha cdebf02e5490989efc159cd1b4bc0645713e1dfc

Add a test that forbids merge commits

view details

bors[bot]

commit sha c31a43d360b9d8c75e56af6abbc1b976a9d5e929

Merge #5862 5862: Add a test that forbids merge commits r=matklad a=dragfire Fixes #5854 Co-authored-by: dragfire <asem.devajit@gmail.com>

view details

Aleksey Kladov

commit sha dddd5806512f6242dc6e2f80f9adf834041610df

"How I survived Git" tips

view details

bors[bot]

commit sha 5b21c7b0e5af305269ba2568a364da75d74f83e5

Merge #5923 5923: "How I survived Git" tips r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>

view details

Aleksey Kladov

commit sha 7f54ded71bc36d7eabc6a96c4f25f5c266db633e

Bump token expansion limit We hit this for redis crate, reported at Reported at https://www.reddit.com/r/rust/comments/ikfsf8/rustanalyzer_doesnt_work_with_the_redis_crate/

view details

bors[bot]

commit sha 754b4c900e843060b25acd63e5de1898eb66a59f

Merge #5926 5926: Bump token expansion limit r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>

view details

Aramis Razzaghipour

commit sha 321108673dc64fa1746fe5be8865fc3bd5444433

Document VS Code setting needed for on-typing assists

view details

kjeremy

commit sha 17d9bed663ab9631e983d2654aa73cae272a0675

Upgrade mocha from `npm audit fix`

view details

bors[bot]

commit sha 425479ea0d81913e721d5e337093bc5bf394bceb

Merge #5929 5929: Upgrade mocha from `npm audit fix` r=matklad a=kjeremy Co-authored-by: kjeremy <kjeremy@gmail.com>

view details

bors[bot]

commit sha e9841f0311c0432fc62db93c0681c2744c2bcbd0

Merge #5927 5927: Document VS Code setting needed for on-typing assists r=matklad a=arzg Fixes #5925. Co-authored-by: Aramis Razzaghipour <aramisnoah@gmail.com>

view details

kjeremy

commit sha bc94db6a2d16f15f0895a7b53ef5528f835bf264

Bump minimum vscode to 1.47

view details

kjeremy

commit sha ffea9bc71e0358755dd031df302f18ce8eb5823f

Update the rest of our node packages

view details

bors[bot]

commit sha 3ffa915cbcf4d7a3988142cd94da0463acc87c8a

Merge #5931 5931: Update vscode to 1.47 and update the rest of our npm packages r=kjeremy a=kjeremy Co-authored-by: kjeremy <kjeremy@gmail.com>

view details

adamrk

commit sha 04fc937700105951442a9b6fa30591fb48a1e879

Add back Param struct

view details

kjeremy

commit sha 62656f09c0a49bd6eb9ed1add6b9ac3273816920

cargo update

view details

kjeremy

commit sha b5272573300766d0c8417161c1a4f959abc9ff43

Move to vscode-languageclient 7.0.0-next.9 Stabilizes call hierarchy and semantic tokens features.

view details

kjeremy

commit sha 36692bdffa59accee75e34647d83cbd8190b7906

Switch to upstream ENUM_MEMBER

view details

bors[bot]

commit sha a2e8e513e4907da2662dcec12c7e9d262873a664

Merge #5936 5936: cargo update r=kjeremy a=kjeremy Co-authored-by: kjeremy <kjeremy@gmail.com>

view details

bors[bot]

commit sha 7f79dbc84f5d69ec6f48fa8d67bdfa0525c5dd34

Merge #5930 5930: Migrate to the latest Semantic Tokens Proposal for LSP 3.16 r=matklad a=kjeremy This stabilizes call hierarchy and semantic tokens features on the client side and changes the server-side semantic tokens protocol to match the latest proposal for 3.16. The server-side change will break clients depending on the earlier semantic tokens draft. Fixes #4942 Co-authored-by: kjeremy <kjeremy@gmail.com>

view details

push time in 21 days

startedyaahc/color-eyre

started time in 22 days

startedasvetliakov/vscode-neovim

started time in a month

startedMerrit/nyrna

started time in a month

startedmuesli/duf

started time in a month

Pull request review commentrust-analyzer/rust-analyzer

Add a command to open docs for the symbol under the cursor

 impl Function {     pub fn diagnostics(self, db: &dyn HirDatabase, sink: &mut DiagnosticSink) {         hir_ty::diagnostics::validate_body(db, self.id.into(), sink)     }++    /// Whether this function declaration has a definition.+    ///+    /// This is false in the case of required (not provided) trait methods.+    pub fn has_body(self, db: &dyn HirDatabase) -> bool {+        db.function_data(self.id).has_body+    }++    /// If this function is a method, the trait or type where it is declared.+    pub fn method_owner(self, db: &dyn HirDatabase) -> Option<MethodOwner> {+        match self.as_assoc_item(db).map(|assoc| assoc.container(db)) {+            Some(AssocItemContainer::Trait(t)) => Some(t.into()),+            Some(AssocItemContainer::ImplDef(imp)) => {+                let resolver = ModuleId::from(imp.module(db)).resolver(db.upcast());+                let ctx = TyLoweringContext::new(db, &resolver);+                let adt = Ty::from_hir(+                    &ctx,+                    &imp.target_trait(db).unwrap_or_else(|| imp.target_type(db)),+                )+                .as_adt()+                .map(|t| t.0)+                .unwrap();+                Some(Adt::from(adt).into())+            }+            None => None,+        }+    } } +#[derive(Debug)]+pub enum MethodOwner {+    Trait(Trait),+    Adt(Adt),

This should be an ImplDef, as inherent impls not necessary refer to adts

Hence the method instead of function naming.

And, with this change, I think this becomes equivalent to AssocItemContainer

The difference is that AssocItemContainer holds an ImplDef, rather than the type that the impl targets. To get to the type you need to use target_type(...) -> TypeRef and then use a TyLoweringContext.

That logic could potentially be moved to a method on ImplDef instead?

zacps

comment created time in a month

PullRequestReviewEvent

Pull request review commentrust-analyzer/rust-analyzer

Add a command to open docs for the symbol under the cursor

 fn get_symbol_filename(db: &RootDatabase, definition: &ModuleDef) -> Option<Stri         ModuleDef::Static(s) => format!("static.{}.html", s.name(db)?),     }) }++enum FieldOrAssocItem {+    Field(Field),+    AssocItem(AssocItem),+}++/// Get the fragment required to link to a specific field, method, associated type, or associated constant.+///+/// ```+/// https://doc.rust-lang.org/std/iter/trait.Iterator.html#tymethod.next+///                                                       ^^^^^^^^^^^^^^+/// ```+fn get_symbol_fragment(db: &dyn HirDatabase, field_or_assoc: &FieldOrAssocItem) -> Option<String> {+    Some(match field_or_assoc {+        FieldOrAssocItem::Field(field) => format!("#structfield.{}", field.name(db)),+        FieldOrAssocItem::AssocItem(assoc) => match assoc {+            AssocItem::Function(function) => {+                let is_trait_method =+                    matches!(function.method_owner(db), Some(MethodOwner::Trait(..)));+                // This distinction may get more complicated when specialisation is available.+                // Rustdoc makes this decision based on whether a method 'has defaultness'.+                // Currently this is only the case for provided trait methods.+                if is_trait_method && !function.has_body(db) {+                    format!("#tymethod.{}", function.name(db))+                } else {+                    format!("#method.{}", function.name(db))+                }+            }+            AssocItem::Const(constant) => format!("#associatedconstant.{}", constant.name(db)?),+            AssocItem::TypeAlias(ty) => format!("#associatedtype.{}", ty.name(db)),+        },+    })+}++fn pick_best(tokens: TokenAtOffset<SyntaxToken>) -> Option<SyntaxToken> {+    return tokens.max_by_key(priority);+    fn priority(n: &SyntaxToken) -> usize {+        match n.kind() {+            IDENT | INT_NUMBER => 3,+            T!['('] | T![')'] => 2,+            kind if kind.is_trivia() => 0,+            _ => 1,+        }+    }+}++#[cfg(test)]+mod tests {+    use expect_test::{expect, Expect};++    use crate::mock_analysis::analysis_and_position;++    fn check(ra_fixture: &str, expect: Expect) {+        let (analysis, position) = analysis_and_position(ra_fixture);+        let url = analysis.external_docs(position).unwrap().expect("could not find url for symbol");++        expect.assert_eq(&url)+    }++    #[test]+    fn test_doc_url_struct() {+        check(+            r#"+pub struct Fo<|>o;+"#,+            expect![[r#"https://docs.rs/test/*/test/struct.Foo.html"#]],+        );+    }++    #[test]+    fn test_doc_url_fn() {+        check(+            r#"+pub fn fo<|>o() {}+"#,+            expect![[r##"https://docs.rs/test/*/test/fn.foo.html#method.foo"##]],+        );+    }++    #[test]+    fn test_doc_url_inherent_method() {+        check(+            r#"+pub struct Foo;++impl Foo {+    pub fn met<|>hod() {}+}++"#,+            expect![[r##"https://docs.rs/test/*/test/struct.Foo.html#method.method"##]],+        );+    }++    #[test]+    fn test_doc_url_trait_provided_method() {+        check(+            r#"+pub trait Bar {+    fn met<|>hod() {}+}++"#,+            expect![[r##"https://docs.rs/test/*/test/trait.Bar.html#method.method"##]],+        );+    }++    #[test]+    fn test_doc_url_trait_required_method() {+        check(+            r#"+pub trait Foo {+    fn met<|>hod();+}++"#,+            expect![[r##"https://docs.rs/test/*/test/trait.Foo.html#tymethod.method"##]],+        );+    }++    #[test]+    fn test_doc_url_field() {+        check(+            r#"+pub struct Foo {+    pub fie<|>ld: ()+}++"#,+            expect![[r##"https://docs.rs/test/*/test/struct.Foo.html#structfield.field"##]],+        );+    }++    // FIXME: ImportMap will return re-export paths instead of public module+    // paths. The correct path to documentation will never be a re-export.+    // This problem stops us from resolving stdlib items included in the prelude+    // such as `Option::Some` correctly.+    #[ignore = "ImportMap may return re-exports"]+    #[test]+    fn test_reexport_order() {

Yep, looks like it. In that case maybe it makes sense to merge this now, and it'll become correct (✨magic✨) if/when it's implemented.

zacps

comment created time in a month

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentrust-analyzer/rust-analyzer

Add a command to open docs for the symbol under the cursor

 fn get_symbol_filename(db: &RootDatabase, definition: &ModuleDef) -> Option<Stri         ModuleDef::Static(s) => format!("static.{}.html", s.name(db)?),     }) }++enum FieldOrAssocItem {+    Field(Field),+    AssocItem(AssocItem),+}++/// Get the fragment required to link to a specific field, method, associated type, or associated constant.+///+/// ```+/// https://doc.rust-lang.org/std/iter/trait.Iterator.html#tymethod.next+///                                                       ^^^^^^^^^^^^^^+/// ```+fn get_symbol_fragment(db: &dyn HirDatabase, field_or_assoc: &FieldOrAssocItem) -> Option<String> {+    Some(match field_or_assoc {+        FieldOrAssocItem::Field(field) => format!("#structfield.{}", field.name(db)),+        FieldOrAssocItem::AssocItem(assoc) => match assoc {+            AssocItem::Function(function) => {+                let is_trait_method =+                    matches!(function.method_owner(db), Some(MethodOwner::Trait(..)));+                // This distinction may get more complicated when specialisation is available.+                // Rustdoc makes this decision based on whether a method 'has defaultness'.+                // Currently this is only the case for provided trait methods.+                if is_trait_method && !function.has_body(db) {+                    format!("#tymethod.{}", function.name(db))+                } else {+                    format!("#method.{}", function.name(db))+                }+            }+            AssocItem::Const(constant) => format!("#associatedconstant.{}", constant.name(db)?),+            AssocItem::TypeAlias(ty) => format!("#associatedtype.{}", ty.name(db)),+        },+    })+}++fn pick_best(tokens: TokenAtOffset<SyntaxToken>) -> Option<SyntaxToken> {+    return tokens.max_by_key(priority);+    fn priority(n: &SyntaxToken) -> usize {+        match n.kind() {+            IDENT | INT_NUMBER => 3,+            T!['('] | T![')'] => 2,+            kind if kind.is_trivia() => 0,+            _ => 1,+        }+    }+}++#[cfg(test)]+mod tests {+    use expect_test::{expect, Expect};++    use crate::mock_analysis::analysis_and_position;++    fn check(ra_fixture: &str, expect: Expect) {+        let (analysis, position) = analysis_and_position(ra_fixture);+        let url = analysis.external_docs(position).unwrap().expect("could not find url for symbol");++        expect.assert_eq(&url)+    }++    #[test]+    fn test_doc_url_struct() {+        check(+            r#"+pub struct Fo<|>o;+"#,+            expect![[r#"https://docs.rs/test/*/test/struct.Foo.html"#]],+        );+    }++    #[test]+    fn test_doc_url_fn() {+        check(+            r#"+pub fn fo<|>o() {}+"#,+            expect![[r##"https://docs.rs/test/*/test/fn.foo.html#method.foo"##]],+        );+    }++    #[test]+    fn test_doc_url_inherent_method() {+        check(+            r#"+pub struct Foo;++impl Foo {+    pub fn met<|>hod() {}+}++"#,+            expect![[r##"https://docs.rs/test/*/test/struct.Foo.html#method.method"##]],+        );+    }++    #[test]+    fn test_doc_url_trait_provided_method() {+        check(+            r#"+pub trait Bar {+    fn met<|>hod() {}+}++"#,+            expect![[r##"https://docs.rs/test/*/test/trait.Bar.html#method.method"##]],+        );+    }++    #[test]+    fn test_doc_url_trait_required_method() {+        check(+            r#"+pub trait Foo {+    fn met<|>hod();+}++"#,+            expect![[r##"https://docs.rs/test/*/test/trait.Foo.html#tymethod.method"##]],+        );+    }++    #[test]+    fn test_doc_url_field() {+        check(+            r#"+pub struct Foo {+    pub fie<|>ld: ()+}++"#,+            expect![[r##"https://docs.rs/test/*/test/struct.Foo.html#structfield.field"##]],+        );+    }++    // FIXME: ImportMap will return re-export paths instead of public module+    // paths. The correct path to documentation will never be a re-export.+    // This problem stops us from resolving stdlib items included in the prelude+    // such as `Option::Some` correctly.+    #[ignore = "ImportMap may return re-exports"]+    #[test]+    fn test_reexport_order() {

@matklad This is the last big issue remaining with this implementation, do you have any views on the best approach?

Another option is to just leave it for now, ImportMap should work in most cases.

zacps

comment created time in a month

startedtrishume/wikicrush

started time in a month

startedhediet/vscode-hediet-power-tools

started time in 2 months

startedalgorithm-archivists/algorithm-archive

started time in 2 months

startednnethercote/counts

started time in 2 months

push eventzacps/rust-analyzer

Zac Pullar-Strecker

commit sha 40747a0273a2b5a5ad7b2d1621aaf448dcadd305

Remove outdated part of doc_links module docs

view details

push time in 2 months

Pull request review commentrust-analyzer/rust-analyzer

Add a command to open docs for the symbol under the cursor

 fn get_symbol_filename(db: &RootDatabase, definition: &ModuleDef) -> Option<Stri         ModuleDef::Static(s) => format!("static.{}.html", s.name(db)?),     }) }++enum FieldOrAssocItem {+    Field(Field),+    AssocItem(AssocItem),+}++/// Get the fragment required to link to a specific field, method, associated type, or associated constant.+///+/// ```+/// https://doc.rust-lang.org/std/iter/trait.Iterator.html#tymethod.next+///                                                       ^^^^^^^^^^^^^^+/// ```+fn get_symbol_fragment(db: &dyn HirDatabase, field_or_assoc: &FieldOrAssocItem) -> Option<String> {+    Some(match field_or_assoc {+        FieldOrAssocItem::Field(field) => format!("#structfield.{}", field.name(db)),+        FieldOrAssocItem::AssocItem(assoc) => match assoc {+            AssocItem::Function(function) => {+                let is_trait_method =+                    matches!(function.method_owner(db), Some(MethodOwner::Trait(..)));+                // This distinction may get more complicated when specialisation is available.+                // Rustdoc makes this decision based on whether a method 'has defaultness'.+                // Currently this is only the case for provided trait methods.+                if is_trait_method && !function.has_body(db) {+                    format!("#tymethod.{}", function.name(db))+                } else {+                    format!("#method.{}", function.name(db))+                }+            }+            AssocItem::Const(constant) => format!("#associatedconstant.{}", constant.name(db)?),+            AssocItem::TypeAlias(ty) => format!("#associatedtype.{}", ty.name(db)),+        },+    })+}++fn pick_best(tokens: TokenAtOffset<SyntaxToken>) -> Option<SyntaxToken> {+    return tokens.max_by_key(priority);+    fn priority(n: &SyntaxToken) -> usize {+        match n.kind() {+            IDENT | INT_NUMBER => 3,+            T!['('] | T![')'] => 2,+            kind if kind.is_trivia() => 0,+            _ => 1,+        }+    }+}++#[cfg(test)]+mod tests {+    use expect_test::{expect, Expect};++    use crate::mock_analysis::analysis_and_position;++    fn check(ra_fixture: &str, expect: Expect) {+        let (analysis, position) = analysis_and_position(ra_fixture);+        let url = analysis.external_docs(position).unwrap().expect("could not find url for symbol");++        expect.assert_eq(&url)+    }++    #[test]+    fn test_doc_url_struct() {+        check(+            r#"+pub struct Fo<|>o;+"#,+            expect![[r#"https://docs.rs/test/*/test/struct.Foo.html"#]],+        );+    }++    #[test]+    fn test_doc_url_fn() {+        check(+            r#"+pub fn fo<|>o() {}+"#,+            expect![[r##"https://docs.rs/test/*/test/fn.foo.html#method.foo"##]],+        );+    }++    #[test]+    fn test_doc_url_inherent_method() {+        check(+            r#"+pub struct Foo;++impl Foo {+    pub fn met<|>hod() {}+}++"#,+            expect![[r##"https://docs.rs/test/*/test/struct.Foo.html#method.method"##]],+        );+    }++    #[test]+    fn test_doc_url_trait_provided_method() {+        check(+            r#"+pub trait Bar {+    fn met<|>hod() {}+}++"#,+            expect![[r##"https://docs.rs/test/*/test/trait.Bar.html#method.method"##]],+        );+    }++    #[test]+    fn test_doc_url_trait_required_method() {+        check(+            r#"+pub trait Foo {+    fn met<|>hod();+}++"#,+            expect![[r##"https://docs.rs/test/*/test/trait.Foo.html#tymethod.method"##]],+        );+    }++    #[test]+    fn test_doc_url_field() {+        check(+            r#"+pub struct Foo {+    pub fie<|>ld: ()+}++"#,+            expect![[r##"https://docs.rs/test/*/test/struct.Foo.html#structfield.field"##]],+        );+    }++    // FIXME: ImportMap will return re-export paths instead of public module+    // paths. The correct path to documentation will never be a re-export.+    // This problem stops us from resolving stdlib items included in the prelude+    // such as `Option::Some` correctly.+    #[ignore = "ImportMap may return re-exports"]+    #[test]+    fn test_reexport_order() {

This is the last real problem with the implementation. I'm not sure what the correct behaviour here is. The command really wants a version of ImportMap which doesn't consider re-exports.

Unfortunately it's in an awkward place where:

  • I don't want to add a behaviour flag, because these are clearly two different usecases and behaviour flags are usually a bad idea anyway
  • The implementation is quite long, so I don't want to simply duplicate it with one minor change

That leaves trying to split up the import map code as the best solution I think?

zacps

comment created time in 2 months

PullRequestReviewEvent

push eventzacps/rust-analyzer

Zac Pullar-Strecker

commit sha c2aa141938aa772d71bc6572f057d9c9dbd7c40f

Add ignored test to demonstrate ImportMap bug

view details

push time in 2 months

push eventzacps/rust-analyzer

Zac Pullar-Strecker

commit sha 09982d8f9ba215afdd3e028944ee1da26e5a38f8

Add ignored test to demonstrate ImportMap bug

view details

push time in 2 months

push eventzacps/rust-analyzer

Zac Pullar-Strecker

commit sha 6709c1687689725ef3649ea855740650c8316981

Fix namespace detection & function test

view details

push time in 2 months

push eventzacps/rust-analyzer

Zac Pullar-Strecker

commit sha 71174ff0ed18ec8a9e4f9ac9705547807c4e6cc1

Add tests

view details

push time in 2 months

push eventzacps/rust-analyzer

Zac Pullar-Strecker

commit sha f707a7c3025d455f97ac869ea60ebaf85b4bcb86

Update tests for new function field

view details

push time in 2 months

push eventzacps/rust-analyzer

Zac Pullar-Strecker

commit sha 55f29255301053aa2578e41af6364b2b5d8f7f4c

Fix send->sent typo

view details

push time in 2 months

push eventzacps/rust-analyzer

Zac Pullar-Strecker

commit sha 69556008ea3222683cade24ffe0742f57cf3bc41

Differentiate method/tymethod by determining 'defaultness' Currently a method only has defaultness if it is a provided trait method, but this will change when specialisation is available and may need to become a concept known to hir. I opted to go for a 'fewest changes' approach given specialisation is still under development.

view details

push time in 2 months

push eventzacps/rust-analyzer

Zac Pullar-Strecker

commit sha 0a9cbbc3a83b0ee63402402decc7c98e5e18a5d4

Document the protocol extension

view details

push time in 2 months

Pull request review commentrust-analyzer/rust-analyzer

Add a command to open docs for the symbol under the cursor

 pub struct CommandLink {     #[serde(skip_serializing_if = "Option::is_none")]     pub tooltip: Option<String>, }++pub enum OpenDocs {}++impl Request for OpenDocs {+    type Params = OpenDocsParams;+    type Result = DocumentationLink;+    const METHOD: &'static str = "rust-analyzer/openDocs";+}++#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]+#[serde(rename_all = "camelCase")]+pub struct OpenDocsParams {+    // TODO: I don't know the difference between these two methods of passing position.+    #[serde(flatten)]+    pub position: lsp_types::TextDocumentPositionParams,+    // pub textDocument: lsp_types::TextDocumentIdentifier,+    // pub position: lsp_types::Position,+}++#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]+#[serde(rename_all = "camelCase")]+pub struct DocumentationLink {+    pub remote: String, // TODO: Better API?+                        // #[serde(skip_serializing_if = "Option::is_none")]+                        // pub remote: Option<String>,+                        // #[serde(skip_serializing_if = "Option::is_none")]+                        // pub local: Option<String>+}

Noticed a few send (should be sent) typos in there, is that intended to match a method name or something?

zacps

comment created time in 2 months

PullRequestReviewEvent

push eventzacps/rust-analyzer

Rüdiger Herrmann

commit sha 3dbe0627413e87f3c69df156a10333e121e5f4c6

Update mentions of 'ra_vfs' in architecture doc Adjust the paragraph about `ra_vfs` to point to the `vfs` crate that is used now.

view details

Veetaha

commit sha 5b9a882edc20810641cb774240e5089e87dab82e

Make inlay hints colors more configurable

view details

Aleksey Kladov

commit sha 0fc8fd2bd589572964d4949cd35aac44659af334

**Inline Variable** works with field shorthand

view details

bors[bot]

commit sha 51f5af223f01e7938fb07821027afe511d480826

Merge #5888 5888: **Inline Variable** works with field shorthand r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>

view details

Aleksey Kladov

commit sha a53c6f6feef231ecfb4e66d0e446e4148e816a2c

Allow redirecting logs to a specific file There's a surprising lack of crates which are like env_logger, but also allow writing to a file. Let's write our own then!

view details

Aleksey Kladov

commit sha bb50614d8871f55ad4f0306cba289681a29c14ef

Simplify help

view details

Aleksey Kladov

commit sha ed6304131a5a738da72b88d5deb67be4555b4c7f

Simplify

view details

bors[bot]

commit sha 868aaf2bc61627ae8e5d920c38b2666756743515

Merge #5889 5889: Allow logging to file r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>

view details

Aleksey Kladov

commit sha 7431ec82c985516213f3283e370b81d067ec0367

Simplify

view details

bors[bot]

commit sha ad60b4e6ea1cbbb4c611f56833af90b43c4a5a3e

Merge #5890 5890: Simplify r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>

view details

bors[bot]

commit sha d58a3a277a1778ec33e492e958b52869510c1239

Merge #5885 5885: Make inlay hints colors more configurable r=matklad a=Veetaha **[BREAKING CHANGE]** Tackles https://github.com/rust-analyzer/rust-analyzer/issues/5337#issuecomment-680018601 and generally related to #5337. Added `foreground/background` color configurations with optional more specific overrides `foreground.(type|parameter|chaining)Hints`. One problem I see is that the config keys are long and don't fit into the on-hover hints in the `settings.json` file entirely... <details> <summary>Demo</summary> ![demo](https://user-images.githubusercontent.com/36276403/91238334-77fc3b00-e745-11ea-836b-2822015ece98.gif) </details> Co-authored-by: Veetaha <veetaha2@gmail.com>

view details

bors[bot]

commit sha a0324a59e97bab5939f7145b65115c62a4c44913

Merge #5879 5879: Update mentions of 'ra_vfs' in architecture doc r=matklad a=rherrmann Adjust the paragraph about `ra_vfs` to point to the `vfs` crate that is used now. Co-authored-by: Rüdiger Herrmann <ruediger.herrmann@gmx.de>

view details

León Orell Valerian Liehr

commit sha 63caef372ad96a4cfc6aeafa52218c426daf7f2a

Improve support for code block attributes

view details

bors[bot]

commit sha 84acd56e978de792db278b624458b96d52fa7b73

Merge #5887 5887: Improve fenced code block support for doctests r=fmease a=fmease Fixes #5783 Co-authored-by: León Orell Valerian Liehr <liehr.exchange@gmx.net>

view details

Jonas Schievink

commit sha 964219f0be87d189e13dd63a6ffc4d9d53eafbb4

Allow running a test as a binary

view details

Aleksey Kladov

commit sha 1c0ac2b9b473b16ab427e2f4d1144029a79c1827

Cleanup hover links tests

view details

bors[bot]

commit sha 3d6c4c143b4b4c74810318eca1b5493e43535fff

Merge #5894 5894: Cleanup hover links tests r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>

view details

bors[bot]

commit sha 7e012ae8b54705bc254154cdff3a503cce3299a7

Merge #5893 5893: Allow running a test as a binary r=matklad a=jonas-schievink If a test uses `harness = false`, it just contains an `fn main` that is executed via `cargo test`. This adds support for that. Note though that Cargo doesn't actually tell us whether `harness = false`, so this hint will always show up when you put an `fn main` into an integration test. Normally people shouldn't be doing that if they do use the harness though. Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>

view details

Aleksey Kladov

commit sha f8a59adf5e9633aa5d10efcdbf70b408d280ef01

Tease apart orthogonal concerns in markdown link rewriting `hir` should know nothing about URLs, markdown and html. It should only be able to: * resolve stringy path from documentation * generate canonical stringy path for a def In contrast, link rewriting should not care about semantics of paths and names resolution, and should be concern only with text mangling bits.

view details

bors[bot]

commit sha e7da5816d67fadc056ee43310f9d04164c2617d9

Merge #5895 5895: Tease apart orthogonal concerns in markdown link rewriting r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>

view details

push time in 2 months

push eventzacps/rust-analyzer

Zac Pullar-Strecker

commit sha 65750be453fd4470ecfb955d85f3a3828df2bc57

Changes from reviewe

view details

push time in 2 months

Pull request review commentrust-analyzer/rust-analyzer

Add a command to open docs for the symbol under the cursor

 export interface CommandLinkGroup {     title?: string;     commands: CommandLink[]; }++export interface DocumentationLink {+    remote: string;

They don't. There's lc.URI but I think that's intended for a different purpose.

zacps

comment created time in 2 months

PullRequestReviewEvent

push eventzacps/rust-analyzer

Zac Pullar-Strecker

commit sha bf94280bfc54e81c5b28e8f4c5c9ec199b233d1a

Changes from reviewe

view details

push time in 2 months

issue openedrust-lang/rust

Associated type bounded on another associated type with a default fails

<!-- Thank you for filing a bug report! 🐛 Please provide a short summary of the bug, along with any information you feel relevant to replicating the bug. -->

I tried this code:

#![feature(associated_type_defaults)]

trait View {
    type Deserializers: Deserializer<Item = Self::RequestParams>;
    type RequestParams = DefaultRequestParams;
}

struct DefaultRequestParams;

trait Deserializer {
    type Item;
    fn deserialize(r: impl Read) -> Self::Item;
}

I expected to see this happen: View::Deserializers has the as of yet unspecified type Deserializer<Item=Self::RequestParams>.

Instead, this happened:

error[E0271]: type mismatch resolving `<<Self as View>::Deserializers as Deserializer>::Item == DefaultRequestParams`
  --> src\lib.rs:17:38
   |
14 | trait View {
   | -------------- required by `View`
...
17 |     type Deserializers: Deserializer<Item = Self::RequestParams>;
   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `DefaultRequestParams`, found associated type
   |
   = note:       expected struct `DefaultRequestParams`
           found associated type `<Self as View>::RequestParams`
   = help: consider constraining the associated type `<Self as View>::RequestParams` to `DefaultRequestParams`
   = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html

This error does not occur when the default is removed.

Meta

<!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. -->

rustc --version --verbose:

rustc 1.47.0-nightly (f44c6e4e2 2020-08-24)

See also: My initial question on the internals forum

RFC 2532 (assocaited type defaults

cc @jonas-schievink

created time in 2 months

push eventzacps/rust-analyzer

Zac Pullar-Strecker

commit sha a310d35763e2c5cae0302742f8a873d893e92f2b

Rename ide::link_rewrite -> ide::doc_links & tidy imports

view details

push time in 2 months

push eventzacps/rust-analyzer

Zac Pullar-Strecker

commit sha b1427c33700e587ec3dc11148c0ab3958483beed

Add support for struct & trait methods

view details

push time in 2 months

push eventzacps/rust-analyzer

Zac Pullar-Strecker

commit sha d4b4d2f0c72b875199d5ff2788580a147eb940d6

Add support for struct & trait methods

view details

push time in 2 months

PR opened rust-analyzer/rust-analyzer

Add a command to open docs for the symbol under the cursor

Todo

  • [ ] Figure out how to get the documentation path for methods and other non-top-level defs
  • [ ] Design the lsp extension. In future we'll probably want parameters for local/remote documentation URLs
  • [ ] Code organisation
  • [ ] Tests
+176 -7

0 comment

11 changed files

pr created time in 2 months

create barnchzacps/rust-analyzer

branch : open-documentation-under-cursor

created branch time in 2 months

Pull request review commentrust-analyzer/rust-analyzer

Tease apart orthogonal concerns in markdown link rewriting

 fn map_links<'e>(         _ => evt,     }) }++fn parse_link(s: &str) -> (&str, Option<hir::Namespace>) {+    let path = strip_prefixes_suffixes(s);+    let ns = ns_from_intra_spec(s);+    (path, ns)+}++/// Strip prefixes, suffixes, and inline code marks from the given string.+fn strip_prefixes_suffixes(mut s: &str) -> &str {+    s = s.trim_matches('`');++    [+        (TYPES.0.iter(), TYPES.1.iter()),+        (VALUES.0.iter(), VALUES.1.iter()),+        (MACROS.0.iter(), MACROS.1.iter()),+    ]+    .iter()+    .for_each(|(prefixes, suffixes)| {+        prefixes.clone().for_each(|prefix| s = s.trim_start_matches(*prefix));+        suffixes.clone().for_each(|suffix| s = s.trim_end_matches(*suffix));+    });+    s.trim_start_matches("@").trim()+}++static TYPES: ([&str; 7], [&str; 0]) =+    (["type", "struct", "enum", "mod", "trait", "union", "module"], []);+static VALUES: ([&str; 8], [&str; 1]) =+    (["value", "function", "fn", "method", "const", "static", "mod", "module"], ["()"]);+static MACROS: ([&str; 1], [&str; 1]) = (["macro"], ["!"]);++/// Extract the specified namespace from an intra-doc-link if one exists.+///+/// # Examples+///+/// * `struct MyStruct` -> `Namespace::Types`+/// * `panic!` -> `Namespace::Macros`+/// * `fn@from_intra_spec` -> `Namespace::Values`+fn ns_from_intra_spec(s: &str) -> Option<hir::Namespace> {+    [+        (hir::Namespace::Types, (TYPES.0.iter(), TYPES.1.iter())),+        (hir::Namespace::Values, (VALUES.0.iter(), VALUES.1.iter())),+        (hir::Namespace::Macros, (MACROS.0.iter(), MACROS.1.iter())),+    ]+    .iter()+    .filter(|(_ns, (prefixes, suffixes))| {+        prefixes+            .clone()+            .map(|prefix| {+                s.starts_with(*prefix)+                    && s.chars()+                        .nth(prefix.len() + 1)+                        .map(|c| c == '@' || c == ' ')+                        .unwrap_or(false)+            })+            .any(|cond| cond)+            || suffixes+                .clone()+                .map(|suffix| {+                    s.starts_with(*suffix)+                        && s.chars()+                            .nth(suffix.len() + 1)+                            .map(|c| c == '@' || c == ' ')+                            .unwrap_or(false)+                })+                .any(|cond| cond)+    })+    .map(|(ns, (_, _))| *ns)+    .next()+}++fn get_doc_url(db: &RootDatabase, krate: &Crate) -> Option<Url> {+    krate+        .get_html_root_url(db)+        .or_else(|| {+            // Fallback to docs.rs. This uses `display_name` and can never be+            // correct, but that's what fallbacks are about.+            //+            // FIXME: clicking on the link should just open the file in the editor,+            // instead of falling back to external urls.+            Some(format!("https://docs.rs/{}/*/", krate.display_name(db)?))

I disagree that we should fallback to opening the file here. It should definitely be an option in general, but the fallback should try to match the behaviour of the rest of the code.

matklad

comment created time in 2 months

PullRequestReviewEvent

pull request commentrust-analyzer/rust-analyzer

Remove monomorphisation from doclinks resolving code

Ah that makes sense.

I learnt a lot during that review, thanks for your patience!

matklad

comment created time in 2 months

startedjamesmunns/nrf52dk-sys

started time in 2 months

push eventzacps/rust-analyzer

unexge

commit sha 128eef779f572a8120cb475d86a373ac4c9e5559

Improve AST replacing in expand glob import

view details

unexge

commit sha bb72150f0214c9395c48fdd3ee93650f0a507112

Handle more cases in AST replacing in expand glob import

view details

unexge

commit sha 11d048af03e0d9e07c5c67c9a644af5fbf94ed57

Run rustfmt

view details

unexge

commit sha 0847bc801eab10ec32792fdc546007a8a1cfbdde

Use `Definition::find_usages` for finding used items in expand glob import

view details

unexge

commit sha 585f5d4901f3ddc0bec6aface8a86707d216886e

Use fixme instead of todo

view details

unexge

commit sha 5d28dec7b93aad54866c80213358fb3eb28153be

Fix importing unused traits in expand glob import

view details

unexge

commit sha 5cff4b60bedf4d0b2e30d08aa19686584202a560

Fix importing private modules in expand glob import

view details

unexge

commit sha ef54e8451d2ebe20e900f9bea4545795ebd035c7

Use new `Definition::usages` API in expand glob import

view details

Veetaha

commit sha 74ed42c8e9057bdd8910d0eba03ea0b30b87e660

Gate stream.pipeline workaround on fixed versions of node

view details

Kirill Bulatov

commit sha cdd75a699aaa9dbf971a8c6b0d59b36c5b6b49e6

Omit lenses for not runnable doctests

view details

dragfire

commit sha 1d129a7172bbe502182be6cc3b50b3250cb6f3a9

Invert if should be smart about is_some, is_none, is_ok, is_err

view details

Pavan Kumar Sunkara

commit sha a8fa5cd42e3cfa131121a46b289ee919e495316e

Add version to deps in cargo.toml

view details

Aleksey Kladov

commit sha d7ece3028de09f30af4384726eca1eff2cd52dff

Add Early Return rule to style

view details

Aleksey Kladov

commit sha fc3e591bdb28745ef29e90de2c1625e6d4e4a229

Avoid monomorphization

view details

bors[bot]

commit sha 6eddcfd7a5e62c5e0b188fcdb084b8147cd7c62c

Merge #5853 5853: Avoid monomorphization r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>

view details

bors[bot]

commit sha 951c7c157af1c70392492ab1bfd6fb291d2ffefb

Merge #5852 5852: Add Early Return rule to style r=matklad a=matklad bors r+ Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>

view details

bors[bot]

commit sha b00702b738ced5218916658aecdb1d105f38e788

Merge #5851 5851: Invert if should be smart about is_some, is_none, is_ok, is_err r=matklad a=dragfire Fixes #5827 Co-authored-by: dragfire <asem.devajit@gmail.com>

view details

Pavan Kumar Sunkara

commit sha 35fd9a8e0ba7013cf95996bfc9221ebe91d3db75

Added weekly publish workflow

view details

Pavan Kumar Sunkara

commit sha 335add49dbd98c13a8dd2b0284cefda00da13ec9

Add description for crates that will be published

view details

bors[bot]

commit sha 150e3843b0f84e74c0476954b03e23b16631d5c8

Merge #5845 5845: Omit lenses for not runnable doctests r=matklad a=SomeoneToIgnore Ideally, we should properly parse the doctest attributes before, but since I need it for the code lens only, this way should suffice for now Co-authored-by: Kirill Bulatov <mail4score@gmail.com>

view details

push time in 2 months

push eventzacps/rust-analyzer

Zac Pullar-Strecker

commit sha 452afaebe188251cd4403e56999bf8b58de4fba9

Changes from review

view details

push time in 2 months

Pull request review commentrust-analyzer/rust-analyzer

Resolve links in hover documentation

+//! Resolves links in markdown documentation.++use std::iter::once;++use itertools::Itertools;+use url::Url;++use crate::{db::HirDatabase, Adt, AsName, Crate, Hygiene, ItemInNs, ModPath, ModuleDef};+use hir_def::{db::DefDatabase, resolver::Resolver};+use syntax::ast::Path;++pub fn resolve_doc_link<T: Resolvable + Clone, D: DefDatabase + HirDatabase>(+    db: &D,+    definition: &T,+    link_text: &str,+    link_target: &str,+) -> Option<(String, String)> {+    try_resolve_intra(db, definition, link_text, &link_target).or_else(|| {+        if let Some(definition) = definition.clone().try_into_module_def() {+            try_resolve_path(db, &definition, &link_target)+                .map(|target| (target, link_text.to_string()))+        } else {+            None+        }+    })+}++/// Try to resolve path to local documentation via intra-doc-links (i.e. `super::gateway::Shard`).+///+/// See [RFC1946](https://github.com/rust-lang/rfcs/blob/master/text/1946-intra-rustdoc-links.md).+fn try_resolve_intra<T: Resolvable, D: DefDatabase + HirDatabase>(

Agreed, but I'm not sure it's easy/possible with the DefDatabase + HirDatabase bound (which also exists in Resolvable).

I know you can declare a trait:

trait DB: DefDatabase + HirDatabase {}

And then create &dyn DB objects, but I don't think there's an easy way to get &dyn DefDatabase/&dyn HirDatabase out of those?

zacps

comment created time in 2 months

PullRequestReviewEvent

Pull request review commentrust-analyzer/rust-analyzer

Resolve links in hover documentation

+//! Resolves links in markdown documentation.++use std::iter::once;++use itertools::Itertools;+use url::Url;++use crate::{db::HirDatabase, Adt, AsName, Crate, Hygiene, ItemInNs, ModPath, ModuleDef};+use hir_def::{db::DefDatabase, resolver::Resolver};+use syntax::ast::Path;++pub fn resolve_doc_link<T: Resolvable + Clone, D: DefDatabase + HirDatabase>(

The docs trait is implemented for T: Into<AttrDef> which is a different set of types from those that implement Resolvable.

Conceptually they're not really the same thing. Resolvable really just means that we can find a base which we can then use to resolve documentation links. There isn't a strict requirement that something implementing Resolvable has, or could have, documentation.

zacps

comment created time in 2 months

PullRequestReviewEvent

Pull request review commentrust-analyzer/rust-analyzer

Resolve links in hover documentation

 version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ee12e4891ab3acc2d95d5023022ace22020247bb8a8d1ece875a443f7dab37d" +[[package]]+name = "unicase"+version = "2.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"+dependencies = [+ "version_check",

There is an open PR here.

The last activity was your comment in November, so I'm not sure it's worth waiting on.

zacps

comment created time in 2 months

PullRequestReviewEvent

push eventzacps/rust-analyzer

Zac Pullar-Strecker

commit sha 5452368fad8ee8d03d980de47604fa108111ea57

Renames, comments, and dead code removal

view details

push time in 2 months

Pull request review commentrust-analyzer/rust-analyzer

Resolve links in hover documentation

 fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> {     } } +// Rewrites a markdown document, resolving links using `callback` and additionally striping prefixes/suffixes on link titles.+fn map_links<'e>(+    events: impl Iterator<Item = Event<'e>>,+    callback: impl Fn(&str, &str) -> (String, String),+) -> impl Iterator<Item = Event<'e>> {+    let mut in_link = false;+    let mut link_target: Option<CowStr> = None;++    events.map(move |evt| match evt {+        Event::Start(Tag::Link(_link_type, ref target, _)) => {+            in_link = true;+            link_target = Some(target.clone());+            evt+        }+        Event::End(Tag::Link(link_type, _target, _)) => {+            in_link = false;+            Event::End(Tag::Link(link_type, link_target.take().unwrap(), CowStr::Borrowed("")))+        }+        Event::Text(s) if in_link => {+            let (link_target_s, link_name) = callback(&link_target.take().unwrap(), &s);+            link_target = Some(CowStr::Boxed(link_target_s.into()));+            Event::Text(CowStr::Boxed(link_name.into()))+        }+        Event::Code(s) if in_link => {+            let (link_target_s, link_name) = callback(&link_target.take().unwrap(), &s);+            link_target = Some(CowStr::Boxed(link_target_s.into()));+            Event::Code(CowStr::Boxed(link_name.into()))+        }+        _ => evt,+    })+}++/// Rewrite documentation links in markdown to point to an online host (e.g. docs.rs)+fn rewrite_links(db: &RootDatabase, markdown: &str, definition: &Definition) -> String {+    let doc = Parser::new_with_broken_link_callback(+        markdown,+        Options::empty(),+        Some(&|label, _| Some((/*url*/ label.to_string(), /*title*/ label.to_string()))),+    );++    let doc = map_links(doc, |target, title: &str| {+        // This check is imperfect, there's some overlap between valid intra-doc links+        // and valid URLs so we choose to be too eager to try to resolve what might be+        // a URL.+        if target.contains("://") {+            (target.to_string(), title.to_string())+        } else {+            // Two posibilities:+            // * path-based links: `../../module/struct.MyStruct.html`+            // * module-based links (AKA intra-doc links): `super::super::module::MyStruct`+            let resolved = try_resolve_intra(db, definition, title, &target).or_else(|| {+                try_resolve_path(db, definition, &target).map(|target| (target, title.to_string()))+            });++            if let Some((target, title)) = resolved {+                (target, title)+            } else {+                (target.to_string(), title.to_string())+            }+        }+    });+    let mut out = String::new();+    cmark(doc, &mut out, None).ok();+    out+}++#[derive(PartialEq, Eq, Hash, Copy, Clone, Debug)]+enum Namespace {+    Types,+    Values,+    Macros,+}++lazy_static!(+    /// Map of namespaces to identifying prefixes and suffixes as defined by RFC1946.+    static ref NS_MAP: HashMap<Namespace, (HashSet<&'static str>, HashSet<&'static str>)> = hashmap!{+        Namespace::Types => (hashset!{"type", "struct", "enum", "mod", "trait", "union", "module"}, hashset!{}),+        Namespace::Values => (hashset!{"value", "function", "fn", "method", "const", "static", "mod", "module"}, hashset!{"()"}),+        Namespace::Macros => (hashset!{"macro"}, hashset!{"!"})+    };+);++impl Namespace {+    /// Extract the specified namespace from an intra-doc-link if one exists.+    fn from_intra_spec(s: &str) -> Option<Self> {+        NS_MAP+            .iter()+            .filter(|(_ns, (prefixes, suffixes))| {+                prefixes+                    .iter()+                    .map(|prefix| {+                        s.starts_with(prefix)+                            && s.chars()+                                .nth(prefix.len() + 1)+                                .map(|c| c == '@' || c == ' ')+                                .unwrap_or(false)+                    })+                    .any(|cond| cond)+                    || suffixes+                        .iter()+                        .map(|suffix| {+                            s.starts_with(suffix)+                                && s.chars()+                                    .nth(suffix.len() + 1)+                                    .map(|c| c == '@' || c == ' ')+                                    .unwrap_or(false)+                        })+                        .any(|cond| cond)+            })+            .map(|(ns, (_, _))| *ns)+            .next()+    }+}++// Strip prefixes, suffixes, and inline code marks from the given string.+fn strip_prefixes_suffixes(mut s: &str) -> &str {+    s = s.trim_matches('`');+    NS_MAP.iter().for_each(|(_, (prefixes, suffixes))| {+        prefixes.iter().for_each(|prefix| s = s.trim_start_matches(prefix));+        suffixes.iter().for_each(|suffix| s = s.trim_end_matches(suffix));+    });+    s.trim_start_matches("@").trim()+}++/// Try to resolve path to local documentation via intra-doc-links (i.e. `super::gateway::Shard`).+///+/// See [RFC1946](https://github.com/rust-lang/rfcs/blob/master/text/1946-intra-rustdoc-links.md).+fn try_resolve_intra(+    db: &RootDatabase,+    definition: &Definition,+    link_text: &str,+    link_target: &str,+) -> Option<(String, String)> {+    // Set link_target for implied shortlinks+    let link_target =+        if link_target.is_empty() { link_text.trim_matches('`') } else { link_target };++    // Namespace disambiguation+    let namespace = Namespace::from_intra_spec(link_target);++    // Strip prefixes/suffixes+    let link_target = strip_prefixes_suffixes(link_target);

I've debated this for a little bit and I'm not sure I think it's worth the mental overhead of another type for the increased type safety.

More than happy to defer to your judgement here if you still think it's a good idea.

zacps

comment created time in 2 months

PullRequestReviewEvent

Pull request review commentrust-analyzer/rust-analyzer

Resolve links in hover documentation

 fn hover_text_from_name_kind(db: &RootDatabase, def: Definition) -> Option<Strin     } } +// Rewrites a markdown document, resolving links using `callback` and additionally striping prefixes/suffixes on link titles.+fn map_links<'e>(+    events: impl Iterator<Item = Event<'e>>,+    callback: impl Fn(&str, &str) -> String,+) -> impl Iterator<Item = Event<'e>> {+    let mut in_link = false;+    let mut link_text = CowStr::Borrowed("");+    events.map(move |evt| match evt {+        Event::Start(Tag::Link(..)) => {+            in_link = true;+            evt+        }+        Event::End(Tag::Link(link_type, target, _)) => {+            in_link = false;+            let target = callback(&target, &link_text);+            Event::End(Tag::Link(link_type, CowStr::Boxed(target.into()), CowStr::Borrowed("")))+        }+        Event::Text(s) if in_link => {+            link_text = s.clone();+            Event::Text(CowStr::Boxed(strip_prefixes_suffixes(&s).into()))+        }+        Event::Code(s) if in_link => {+            link_text = s.clone();+            Event::Code(CowStr::Boxed(strip_prefixes_suffixes(&s).into()))+        }+        _ => evt,+    })+}++/// Rewrite documentation links in markdown to point to local documentation/docs.rs+fn rewrite_links(db: &RootDatabase, markdown: &str, definition: &Definition) -> Option<String> {+    let doc = Parser::new_with_broken_link_callback(+        markdown,+        Options::empty(),+        Some(&|label, _| Some((/*url*/ label.to_string(), /*title*/ label.to_string()))),+    );++    let doc = map_links(doc, |target, title: &str| {+        match Url::parse(target) {+            // If this is a valid absolute URL don't touch it+            Ok(_) => target.to_string(),+            // Otherwise there are two main possibilities+            // path-based links: `../../module/struct.MyStruct.html`+            // module-based links (AKA intra-doc links): `super::super::module::MyStruct`+            Err(_) => {+                let resolved = try_resolve_intra(db, definition, title, &target)+                    .or_else(|| try_resolve_path(db, definition, &target));++                if let Some(resolved) = resolved {+                    resolved+                } else {+                    target.to_string()+                }+            }+        }+    });+    let mut out = String::new();+    cmark(doc, &mut out, None).ok();+    Some(out)+}++#[derive(PartialEq, Eq, Hash, Copy, Clone, Debug)]+enum Namespace {+    Types,+    Values,+    Macros,+}++lazy_static!(+    /// Map of namespaces to identifying prefixes and suffixes as defined by RFC1946.+    static ref NS_MAP: HashMap<Namespace, (HashSet<&'static str>, HashSet<&'static str>)> = hashmap!{+        Namespace::Types => (hashset!{"type", "struct", "enum", "mod", "trait", "union", "module"}, hashset!{}),+        Namespace::Values => (hashset!{"value", "function", "fn", "method", "const", "static", "mod", "module"}, hashset!{"()"}),+        Namespace::Macros => (hashset!{"macro"}, hashset!{"!"})+    };+);++impl Namespace {+    /// Extract the specified namespace from an intra-doc-link if one exists.+    fn from_intra_spec(s: &str) -> Option<Self> {+        NS_MAP+            .iter()+            .filter(|(_ns, (prefixes, suffixes))| {+                prefixes+                    .iter()+                    .map(|prefix| {+                        s.starts_with(prefix)+                            && s.chars()+                                .nth(prefix.len() + 1)+                                .map(|c| c == '@' || c == ' ')+                                .unwrap_or(false)+                    })+                    .any(|cond| cond)+                    || suffixes+                        .iter()+                        .map(|suffix| {+                            s.starts_with(suffix)+                                && s.chars()+                                    .nth(suffix.len() + 1)+                                    .map(|c| c == '@' || c == ' ')+                                    .unwrap_or(false)+                        })+                        .any(|cond| cond)+            })+            .map(|(ns, (_, _))| *ns)+            .next()+    }+}++// Strip prefixes, suffixes, and inline code marks from the given string.+fn strip_prefixes_suffixes(mut s: &str) -> &str {+    s = s.trim_matches('`');+    NS_MAP.iter().for_each(|(_, (prefixes, suffixes))| {+        prefixes.iter().for_each(|prefix| s = s.trim_start_matches(prefix));+        suffixes.iter().for_each(|suffix| s = s.trim_end_matches(suffix));+    });+    s.trim_start_matches("@").trim()+}++/// Try to resolve path to local documentation via intra-doc-links (i.e. `super::gateway::Shard`).+///+/// See [RFC1946](https://github.com/rust-lang/rfcs/blob/master/text/1946-intra-rustdoc-links.md).+fn try_resolve_intra(+    db: &RootDatabase,+    definition: &Definition,+    link_text: &str,+    link_target: &str,+) -> Option<String> {+    // Set link_target for implied shortlinks+    let link_target =+        if link_target.is_empty() { link_text.trim_matches('`') } else { link_target };++    // Namespace disambiguation+    let namespace = Namespace::from_intra_spec(link_target);++    // Strip prefixes/suffixes+    let link_target = strip_prefixes_suffixes(link_target);++    // Parse link as a module path+    // This expects a full document, which a single path isn't, but we can just ignore the errors.+    let parsed = SyntaxNode::new_root(ra_syntax::parse_text(link_target).0);+    let path = parsed.descendants().filter_map(Path::cast).next()?;+    let modpath = ModPath::from_src(path, &Hygiene::new_unhygienic()).unwrap();++    // Resolve it relative to symbol's location (according to the RFC this should consider small scopes+    let resolver = definition.resolver(db)?;++    let resolved = resolver.resolve_module_path_in_items(db, &modpath);+    let (defid, namespace) = match namespace {+        // FIXME: .or(resolved.macros)+        None => resolved+            .types+            .map(|t| (t.0, Namespace::Types))+            .or(resolved.values.map(|t| (t.0, Namespace::Values)))?,+        Some(ns @ Namespace::Types) => (resolved.types?.0, ns),+        Some(ns @ Namespace::Values) => (resolved.values?.0, ns),+        // FIXME:+        Some(Namespace::Macros) => None?,+    };++    // Get the filepath of the final symbol+    let def: ModuleDef = defid.into();+    let module = def.module(db)?;+    let krate = module.krate();+    let ns = match namespace {+        Namespace::Types => ItemInNs::Types(defid),+        Namespace::Values => ItemInNs::Values(defid),+        // FIXME:+        Namespace::Macros => None?,+    };+    let import_map = db.import_map(krate.into());+    let path = import_map.path_of(ns)?;++    Some(+        get_doc_url(db, &krate)?+            .join(&format!("{}/", krate.display_name(db)?))+            .ok()?+            .join(&path.segments.iter().map(|name| format!("{}", name)).join("/"))+            .ok()?+            .join(&get_symbol_filename(db, &Definition::ModuleDef(def))?)+            .ok()?+            .into_string(),+    )+}++/// Try to resolve path to local documentation via path-based links (i.e. `../gateway/struct.Shard.html`).+fn try_resolve_path(db: &RootDatabase, definition: &Definition, link: &str) -> Option<String> {+    if !link.contains("#") && !link.contains(".html") {+        return None;+    }+    let ns = if let Definition::ModuleDef(moddef) = definition {+        ItemInNs::Types(moddef.clone().into())+    } else {+        return None;+    };+    let module = definition.module(db)?;+    let krate = module.krate();+    let import_map = db.import_map(krate.into());+    let base = once(format!("{}", krate.display_name(db)?))+        .chain(import_map.path_of(ns)?.segments.iter().map(|name| format!("{}", name)))+        .join("/");++    get_doc_url(db, &krate)+        .and_then(|url| url.join(&base).ok())+        .and_then(|url| {+            get_symbol_filename(db, definition).as_deref().map(|f| url.join(f).ok()).flatten()+        })+        .and_then(|url| url.join(link).ok())+        .map(|url| url.into_string())+}++/// Try to get the root URL of the documentation of a crate.+// FIXME: Special case standard, core, alloc libraries+fn get_doc_url(db: &RootDatabase, krate: &Crate) -> Option<Url> {+    // Look for #![doc(html_root_url = "...")]+    let attrs = db.attrs(AttrDef::from(krate.root_module(db)?).into());+    let doc_attr_q = attrs.by_key("doc");+    let doc_url = if doc_attr_q.exists() {+        doc_attr_q.tt_values().filter_map(|tt| match tt.token_trees.as_slice() {+            &[+                TokenTree::Leaf(Leaf::Ident(Ident{text: ref ident_text, ..})),+                TokenTree::Leaf(Leaf::Punct(Punct{r#char: '=', ..})),+                TokenTree::Leaf(Leaf::Literal(Literal{ref text, ..}))+            ] if ident_text == "html_root_url" => Some(text.to_string()),+            _ => {+                None+            }+        }).next()+    } else {+        // Fallback to docs.rs+        // FIXME: Specify an exact version here (from Cargo.lock)+        Some(format!("https://docs.rs/{}/*", krate.display_name(db)?))

I've updated the note to mention the multiple versions of a crate possibility. Ultimately I think this can be left for now.

zacps

comment created time in 2 months

PullRequestReviewEvent

Pull request review commentrust-analyzer/rust-analyzer

Resolve links in hover documentation

 fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> {     } } +// Rewrites a markdown document, resolving links using `callback` and additionally striping prefixes/suffixes on link titles.+fn map_links<'e>(+    events: impl Iterator<Item = Event<'e>>,+    callback: impl Fn(&str, &str) -> (String, String),+) -> impl Iterator<Item = Event<'e>> {+    let mut in_link = false;+    let mut link_target: Option<CowStr> = None;++    events.map(move |evt| match evt {+        Event::Start(Tag::Link(_link_type, ref target, _)) => {+            in_link = true;+            link_target = Some(target.clone());+            evt+        }+        Event::End(Tag::Link(link_type, _target, _)) => {+            in_link = false;+            Event::End(Tag::Link(link_type, link_target.take().unwrap(), CowStr::Borrowed("")))+        }+        Event::Text(s) if in_link => {+            let (link_target_s, link_name) = callback(&link_target.take().unwrap(), &s);+            link_target = Some(CowStr::Boxed(link_target_s.into()));+            Event::Text(CowStr::Boxed(link_name.into()))+        }+        Event::Code(s) if in_link => {+            let (link_target_s, link_name) = callback(&link_target.take().unwrap(), &s);+            link_target = Some(CowStr::Boxed(link_target_s.into()));+            Event::Code(CowStr::Boxed(link_name.into()))+        }+        _ => evt,+    })+}++/// Rewrite documentation links in markdown to point to an online host (e.g. docs.rs)+fn rewrite_links(db: &RootDatabase, markdown: &str, definition: &Definition) -> String {+    let doc = Parser::new_with_broken_link_callback(+        markdown,+        Options::empty(),+        Some(&|label, _| Some((/*url*/ label.to_string(), /*title*/ label.to_string()))),+    );++    let doc = map_links(doc, |target, title: &str| {+        // This check is imperfect, there's some overlap between valid intra-doc links+        // and valid URLs so we choose to be too eager to try to resolve what might be+        // a URL.+        if target.contains("://") {+            (target.to_string(), title.to_string())+        } else {+            // Two posibilities:+            // * path-based links: `../../module/struct.MyStruct.html`+            // * module-based links (AKA intra-doc links): `super::super::module::MyStruct`+            let resolved = try_resolve_intra(db, definition, title, &target).or_else(|| {

I still prefer this name as it makes the distinction from try_resolve_path clearer. Again, this function is internal so I don't think it needs to be agonised over.

zacps

comment created time in 2 months

PullRequestReviewEvent

Pull request review commentrust-analyzer/rust-analyzer

Resolve links in hover documentation

 fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> {     } } +// Rewrites a markdown document, resolving links using `callback` and additionally striping prefixes/suffixes on link titles.+fn map_links<'e>(+    events: impl Iterator<Item = Event<'e>>,+    callback: impl Fn(&str, &str) -> (String, String),+) -> impl Iterator<Item = Event<'e>> {+    let mut in_link = false;+    let mut link_target: Option<CowStr> = None;++    events.map(move |evt| match evt {+        Event::Start(Tag::Link(_link_type, ref target, _)) => {+            in_link = true;+            link_target = Some(target.clone());+            evt+        }+        Event::End(Tag::Link(link_type, _target, _)) => {+            in_link = false;+            Event::End(Tag::Link(link_type, link_target.take().unwrap(), CowStr::Borrowed("")))+        }+        Event::Text(s) if in_link => {+            let (link_target_s, link_name) = callback(&link_target.take().unwrap(), &s);+            link_target = Some(CowStr::Boxed(link_target_s.into()));+            Event::Text(CowStr::Boxed(link_name.into()))+        }+        Event::Code(s) if in_link => {+            let (link_target_s, link_name) = callback(&link_target.take().unwrap(), &s);+            link_target = Some(CowStr::Boxed(link_target_s.into()));+            Event::Code(CowStr::Boxed(link_name.into()))+        }+        _ => evt,+    })+}++/// Rewrite documentation links in markdown to point to an online host (e.g. docs.rs)+fn rewrite_links(db: &RootDatabase, markdown: &str, definition: &Definition) -> String {+    let doc = Parser::new_with_broken_link_callback(+        markdown,+        Options::empty(),+        Some(&|label, _| Some((/*url*/ label.to_string(), /*title*/ label.to_string()))),+    );++    let doc = map_links(doc, |target, title: &str| {+        // This check is imperfect, there's some overlap between valid intra-doc links+        // and valid URLs so we choose to be too eager to try to resolve what might be+        // a URL.+        if target.contains("://") {+            (target.to_string(), title.to_string())+        } else {+            // Two posibilities:+            // * path-based links: `../../module/struct.MyStruct.html`+            // * module-based links (AKA intra-doc links): `super::super::module::MyStruct`+            let resolved = try_resolve_intra(db, definition, title, &target).or_else(|| {+                try_resolve_path(db, definition, &target).map(|target| (target, title.to_string()))

I still think this name is the best choice. At this point the input is a filesystem path which just happens to get interpreted as part of a url.

This method is internal anyway and doesn't make up a public interface.

zacps

comment created time in 2 months

PullRequestReviewEvent

Pull request review commentrust-analyzer/rust-analyzer

Resolve links in hover documentation

 impl ModuleDef {             ModuleDef::Function(it) => Some(it.name(db)),             ModuleDef::EnumVariant(it) => Some(it.name(db)),             ModuleDef::TypeAlias(it) => Some(it.name(db)),-             ModuleDef::Module(it) => it.name(db),             ModuleDef::Const(it) => it.name(db),             ModuleDef::Static(it) => it.name(db),              ModuleDef::BuiltinType(it) => Some(it.as_name()),         }     }++    pub fn resolver<D: DefDatabase + HirDatabase>(&self, db: &D) -> Option<Resolver> {

I ended up implementing it as part of a trait in ide which is used as a generic bound on the new hir::link_rewrite::resolve_doc_link API. The docs trait is implemented for a slightly different set of types.

zacps

comment created time in 2 months

PullRequestReviewEvent

push eventzacps/rust-analyzer

Urban Dove

commit sha b32528659a64f74da4b652c44b9fb47844899809

try select correct workspace in vscode multi workspace

view details

Urban Dove

commit sha a85e64770d13598103c9122c6514ec3d5a3b0d53

delete empty line

view details

Aleksey Kladov

commit sha e0f21133cd03c6160fbc97b70bbd50ccde4fe6d9

Reorder

view details

Aleksey Kladov

commit sha 08ea2271e8050165d0aaf4c994ed3dd746aff3ba

Rename TypeRef -> Type The TypeRef name comes from IntelliJ days, where you often have both type *syntax* as well as *semantical* representation of types in scope. And naming both Type is confusing. In rust-analyzer however, we use ast types as `ast::Type`, and have many more semantic counterparts to ast types, so avoiding name clash here is just confusing.

view details

bors[bot]

commit sha 683d0a4d93c29c988c40c001a4b574d8f0dcb9c6

Merge #5618 5618: Rename TypeRef -> Type r=matklad a=matklad The TypeRef name comes from IntelliJ days, where you often have both type *syntax* as well as *semantical* representation of types in scope. And naming both Type is confusing. In rust-analyzer however, we use ast types as `ast::Type`, and have many more semantic counterparts to ast types, so avoiding name clash here is just confusing. bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>

view details

bors[bot]

commit sha 8c802a3dbb5ea1dea8de17f59d0620e3a710474a

Merge #5513 5513: Try figure out correct workspace in vscode multi root workspace r=vsrs a=urbandove the code to replace the root with the `${workspaceRoot}` arg breaks in multi root workspaces as it needs a qualifier `${workspaceRoot:workspaceName}` This PR attempts to figure out the root workspace - and if it cant find it falls back to the first workspace Co-authored-by: Urban Dove <urbandove80@gmail.com>

view details

Aleksey Kladov

commit sha a6e45c6c69bf258118940941c12d057deb79e60c

Reame PlaceholderType -> InferType

view details

bors[bot]

commit sha eccb5d52d3c4b82b6b61e231aa137b4aeb8c94ec

Merge #5619 5619: Reame PlaceholderType -> InferType r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>

view details

Aleksey Kladov

commit sha a6527ed92cb7a1156b8a118f5790d8c5fd69ab41

"Finalize" Types grammar Note that `for` type is rust-analyzer's own invention. Both the reference and syn allow `for` only for fnptr types, and we allow them everywhere. This needs to be checked with respect to type bounds grammar...

view details

bors[bot]

commit sha 847a50e74e3e45ea84f38efb23788fa5a61566eb

Merge #5620 5620: Finalize Types grammar r=matklad a=matklad Note that `for` type is rust-analyzer's own invention. Both the reference and syn allow `for` only for fnptr types, and we allow them everywhere. This needs to be checked with respect to type bounds grammar... bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>

view details

Aleksey Kladov

commit sha b250ae6c55c446f65f85914d98da2cd2c75871f7

Finalize TypeBound grammar

view details

bors[bot]

commit sha 84bf0240941b645ef9f8c57b81db30659f7c68e4

Merge #5621 5621: Finalize TypeBound grammar r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>

view details

Aleksey Kladov

commit sha c04c06c4bc06852610af9d37673b03a8c041b15c

Finalize WhereClause gramamr

view details

Aleksey Kladov

commit sha 4d38b0dce1884dab0da7394ccc979eef0a21076c

Move Stmt Grammar

view details

bors[bot]

commit sha 3407d6f8a430627be333c32cb4cef02c0c8d11e3

Merge #5622 5622: Finalize WhereClause gramamr r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>

view details

Aleksey Kladov

commit sha a7ca6583fbce6f1bddce7b31ad5bb1fc0665b616

Handwrite Stmt

view details

Aleksey Kladov

commit sha d4d986c7f850e1f535bb4c22e3a7f7fba5483628

Item is a Stmt

view details

bors[bot]

commit sha ad239f6197bda31f7a9b904b5ccb25c93cbc701a

Merge #5623 5623: Item is a Stmt r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>

view details

Aleksey Kladov

commit sha bfcee63e75d6feb21cafbdf3887e0efd508b6b2e

Work on expressions grammar

view details

Aleksey Kladov

commit sha 633aace41108b74fe6c93c5ab04272067db033f9

Rename LambdaExpr -> ClosureExpr

view details

push time in 2 months

push eventzacps/rust-analyzer

Zac Pullar-Strecker

commit sha ca464650eeaca6195891199a93f4f76cf3e7e697

Add a test to document unimplemented case

view details

push time in 2 months

push eventzacps/rust-analyzer

Zac Pullar-Strecker

commit sha 4f5f608b499ad50aa66b2213e3b92dd2fe61ed68

Reorganise code

view details

push time in 2 months

pull request commentseanmonstar/reqwest

Add must_use to ClientBuilder & RequestBuilder

Yep, I've added a message for RequestBuilder.

zacps

comment created time in 2 months

more