From 1ff42b54422b2ed3e93384abedbc241c81799817 Mon Sep 17 00:00:00 2001 From: coder3101 Date: Sun, 12 Jan 2025 21:57:57 +0530 Subject: [PATCH] feat: Add import path and tree refactor --- src/lsp.rs | 20 ------ src/nodekind.rs | 6 ++ src/parser/definition.rs | 4 +- src/parser/diagnostics.rs | 2 +- src/parser/hover.rs | 4 +- src/parser/input/test_filter.proto | 3 + src/parser/rename.rs | 6 +- ...protols__parser__tree__test__filter-3.snap | 6 ++ src/parser/tree.rs | 34 ++++++++--- src/server.rs | 30 ++++++++- src/state.rs | 2 +- src/workspace/hover.rs | 61 ++++++++++--------- ...__hover__test__workspace_test_hover-2.snap | 5 +- ...__hover__test__workspace_test_hover-3.snap | 5 +- ...__hover__test__workspace_test_hover-4.snap | 5 +- ...__hover__test__workspace_test_hover-5.snap | 5 +- ...__hover__test__workspace_test_hover-6.snap | 6 ++ ...ce__hover__test__workspace_test_hover.snap | 5 +- 18 files changed, 123 insertions(+), 86 deletions(-) create mode 100644 src/parser/snapshots/protols__parser__tree__test__filter-3.snap create mode 100644 src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover-6.snap diff --git a/src/lsp.rs b/src/lsp.rs index 715825c..55e0bc9 100644 --- a/src/lsp.rs +++ b/src/lsp.rs @@ -51,25 +51,6 @@ impl LanguageServer for ProtoLanguageServer { }, }]; - let worktoken = params.work_done_progress_params.work_done_token; - let (tx, rx) = mpsc::channel(); - let mut socket = self.client.clone(); - - thread::spawn(move || { - let Some(token) = worktoken else { - return; - }; - - while let Ok(value) = rx.recv() { - if let Err(e) = socket.progress(ProgressParams { - token: token.clone(), - value, - }) { - error!(error=%e, "failed to report parse progress"); - } - } - }); - let file_registration_option = FileOperationRegistrationOptions { filters: file_operation_filers.clone(), }; @@ -80,7 +61,6 @@ impl LanguageServer for ProtoLanguageServer { for workspace in folders { info!("Workspace folder: {workspace:?}"); self.configs.add_workspace(&workspace); - self.state.add_workspace_folder_async(workspace, tx.clone()); } workspace_capabilities = Some(WorkspaceServerCapabilities { workspace_folders: Some(WorkspaceFoldersServerCapabilities { diff --git a/src/nodekind.rs b/src/nodekind.rs index 0205ff0..fc042e4 100644 --- a/src/nodekind.rs +++ b/src/nodekind.rs @@ -11,6 +11,7 @@ pub enum NodeKind { ServiceName, RpcName, PackageName, + PackageImport, } #[allow(unused)] @@ -26,6 +27,7 @@ impl NodeKind { NodeKind::ServiceName => "service_name", NodeKind::RpcName => "rpc_name", NodeKind::PackageName => "full_ident", + NodeKind::PackageImport => "import", } } @@ -37,6 +39,10 @@ impl NodeKind { n.kind() == Self::Error.as_str() } + pub fn is_import_path(n: &Node) -> bool { + n.kind() == Self::PackageImport.as_str() + } + pub fn is_package_name(n: &Node) -> bool { n.kind() == Self::PackageName.as_str() } diff --git a/src/parser/definition.rs b/src/parser/definition.rs index 97027c5..600f653 100644 --- a/src/parser/definition.rs +++ b/src/parser/definition.rs @@ -25,7 +25,7 @@ impl ParsedTree { match identifier.split_once('.') { Some((parent_identifier, remaining)) => { let child_node = self - .filter_nodes_from(n, NodeKind::is_userdefined) + .find_all_nodes_from(n, NodeKind::is_userdefined) .into_iter() .find(|n| { n.utf8_text(content.as_ref()).expect("utf8-parse error") @@ -39,7 +39,7 @@ impl ParsedTree { } None => { let locations: Vec = self - .filter_nodes_from(n, NodeKind::is_userdefined) + .find_all_nodes_from(n, NodeKind::is_userdefined) .into_iter() .filter(|n| { n.utf8_text(content.as_ref()).expect("utf-8 parse error") == identifier diff --git a/src/parser/diagnostics.rs b/src/parser/diagnostics.rs index e84f5f2..3fa007b 100644 --- a/src/parser/diagnostics.rs +++ b/src/parser/diagnostics.rs @@ -7,7 +7,7 @@ use super::ParsedTree; impl ParsedTree { pub fn collect_parse_errors(&self) -> PublishDiagnosticsParams { let diagnostics = self - .filter_nodes(NodeKind::is_error) + .find_all_nodes(NodeKind::is_error) .into_iter() .map(|n| Diagnostic { range: Range { diff --git a/src/parser/hover.rs b/src/parser/hover.rs index b80cfa7..084f206 100644 --- a/src/parser/hover.rs +++ b/src/parser/hover.rs @@ -66,7 +66,7 @@ impl ParsedTree { match identifier.split_once('.') { Some((parent, child)) => { let child_node = self - .filter_nodes_from(n, NodeKind::is_userdefined) + .find_all_nodes_from(n, NodeKind::is_userdefined) .into_iter() .find(|n| n.utf8_text(content.as_ref()).expect("utf8-parse error") == parent) .and_then(|n| n.parent()); @@ -77,7 +77,7 @@ impl ParsedTree { } None => { let comments: Vec = self - .filter_nodes_from(n, NodeKind::is_userdefined) + .find_all_nodes_from(n, NodeKind::is_userdefined) .into_iter() .filter(|n| { n.utf8_text(content.as_ref()).expect("utf-8 parse error") == identifier diff --git a/src/parser/input/test_filter.proto b/src/parser/input/test_filter.proto index 2d36db0..6c928d1 100644 --- a/src/parser/input/test_filter.proto +++ b/src/parser/input/test_filter.proto @@ -2,6 +2,9 @@ syntax = "proto3"; package com.parser; +import "foo/bar.proto"; +import "baz/bar.proto"; + message Book { message Author { diff --git a/src/parser/rename.rs b/src/parser/rename.rs index 56ad4a8..cb627af 100644 --- a/src/parser/rename.rs +++ b/src/parser/rename.rs @@ -28,7 +28,7 @@ impl ParsedTree { content: impl AsRef<[u8]>, ) -> Option>> { n.parent().map(|p| { - self.filter_nodes_from(p, NodeKind::is_field_name) + self.find_all_nodes_from(p, NodeKind::is_field_name) .into_iter() .filter(|i| i.utf8_text(content.as_ref()).expect("utf-8 parse error") == identifier) .collect() @@ -114,7 +114,7 @@ impl ParsedTree { new_identifier: &str, content: impl AsRef<[u8]>, ) -> Vec { - self.filter_nodes(NodeKind::is_field_name) + self.find_all_nodes(NodeKind::is_field_name) .into_iter() .filter(|n| { let ntext = n.utf8_text(content.as_ref()).expect("utf-8 parse error"); @@ -135,7 +135,7 @@ impl ParsedTree { } pub fn reference_field(&self, id: &str, content: impl AsRef<[u8]>) -> Vec { - self.filter_nodes(NodeKind::is_field_name) + self.find_all_nodes(NodeKind::is_field_name) .into_iter() .filter(|n| n.utf8_text(content.as_ref()).expect("utf-8 parse error") == id) .map(|n| Location { diff --git a/src/parser/snapshots/protols__parser__tree__test__filter-3.snap b/src/parser/snapshots/protols__parser__tree__test__filter-3.snap new file mode 100644 index 0000000..6dc639c --- /dev/null +++ b/src/parser/snapshots/protols__parser__tree__test__filter-3.snap @@ -0,0 +1,6 @@ +--- +source: src/parser/tree.rs +expression: imports +--- +- foo/bar.proto +- baz/bar.proto diff --git a/src/parser/tree.rs b/src/parser/tree.rs index b4c4844..e91872b 100644 --- a/src/parser/tree.rs +++ b/src/parser/tree.rs @@ -6,7 +6,7 @@ use crate::{nodekind::NodeKind, utils::lsp_to_ts_point}; use super::ParsedTree; impl ParsedTree { - pub(super) fn walk_and_collect_filter<'a>( + pub(super) fn walk_and_filter<'a>( cursor: &mut TreeCursor<'a>, f: fn(&Node) -> bool, early: bool, @@ -24,7 +24,7 @@ impl ParsedTree { } if cursor.goto_first_child() { - v.extend(Self::walk_and_collect_filter(cursor, f, early)); + v.extend(Self::walk_and_filter(cursor, f, early)); cursor.goto_parent(); } @@ -110,29 +110,41 @@ impl ParsedTree { self.tree.root_node().descendant_for_point_range(pos, pos) } - pub fn filter_nodes(&self, f: fn(&Node) -> bool) -> Vec { - self.filter_nodes_from(self.tree.root_node(), f) + pub fn find_all_nodes(&self, f: fn(&Node) -> bool) -> Vec { + self.find_all_nodes_from(self.tree.root_node(), f) } - pub fn filter_nodes_from<'a>(&self, n: Node<'a>, f: fn(&Node) -> bool) -> Vec> { + pub fn find_all_nodes_from<'a>(&self, n: Node<'a>, f: fn(&Node) -> bool) -> Vec> { let mut cursor = n.walk(); - Self::walk_and_collect_filter(&mut cursor, f, false) + Self::walk_and_filter(&mut cursor, f, false) } - pub fn find_node(&self, f: fn(&Node) -> bool) -> Vec { + pub fn find_first_node(&self, f: fn(&Node) -> bool) -> Vec { self.find_node_from(self.tree.root_node(), f) } pub fn find_node_from<'a>(&self, n: Node<'a>, f: fn(&Node) -> bool) -> Vec> { let mut cursor = n.walk(); - Self::walk_and_collect_filter(&mut cursor, f, true) + Self::walk_and_filter(&mut cursor, f, true) } pub fn get_package_name<'a>(&self, content: &'a [u8]) -> Option<&'a str> { - self.find_node(NodeKind::is_package_name) + self.find_first_node(NodeKind::is_package_name) .first() .map(|n| n.utf8_text(content).expect("utf-8 parse error")) } + pub fn get_import_path<'a>(&self, content: &'a [u8]) -> Vec<&'a str> { + self.find_all_nodes(NodeKind::is_import_path) + .into_iter() + .filter_map(|n| { + n.child_by_field_name("path").map(|c| { + c.utf8_text(content) + .expect("utf-8 parse error") + .trim_matches('"') + }) + }) + .collect() + } } #[cfg(test)] @@ -150,7 +162,7 @@ mod test { assert!(parsed.is_some()); let tree = parsed.unwrap(); - let nodes = tree.filter_nodes(NodeKind::is_message_name); + let nodes = tree.find_all_nodes(NodeKind::is_message_name); assert_eq!(nodes.len(), 2); @@ -163,5 +175,7 @@ mod test { let package_name = tree.get_package_name(contents.as_ref()); assert_yaml_snapshot!(package_name); + let imports = tree.get_import_path(contents.as_ref()); + assert_yaml_snapshot!(imports); } } diff --git a/src/server.rs b/src/server.rs index a1aa956..da69b6c 100644 --- a/src/server.rs +++ b/src/server.rs @@ -1,5 +1,13 @@ -use async_lsp::{router::Router, ClientSocket}; -use std::ops::ControlFlow; +use async_lsp::{ + lsp_types::{NumberOrString, ProgressParams, ProgressParamsValue}, + router::Router, + ClientSocket, LanguageClient, +}; +use std::{ + ops::ControlFlow, + sync::{mpsc, mpsc::Sender}, + thread, +}; use crate::{config::workspace::WorkspaceProtoConfigs, state::ProtoLanguageState}; @@ -27,4 +35,22 @@ impl ProtoLanguageServer { self.counter += 1; ControlFlow::Continue(()) } + + fn with_report_progress(&self, token: NumberOrString) -> Sender { + let (tx, rx) = mpsc::channel(); + let mut socket = self.client.clone(); + + thread::spawn(move || { + while let Ok(value) = rx.recv() { + if let Err(e) = socket.progress(ProgressParams { + token: token.clone(), + value, + }) { + tracing::error!(error=%e, "failed to report parse progress"); + } + } + }); + + tx + } } diff --git a/src/state.rs b/src/state.rs index fc20510..2a81dc9 100644 --- a/src/state.rs +++ b/src/state.rs @@ -208,7 +208,7 @@ impl ProtoLanguageState { .into_iter() .fold(vec![], |mut v, tree| { let content = self.get_content(&tree.uri); - let t = tree.filter_nodes(f).into_iter().map(|n| CompletionItem { + let t = tree.find_all_nodes(f).into_iter().map(|n| CompletionItem { label: n.utf8_text(content.as_bytes()).unwrap().to_string(), kind: Some(k), ..Default::default() diff --git a/src/workspace/hover.rs b/src/workspace/hover.rs index 29e3b70..01e6064 100644 --- a/src/workspace/hover.rs +++ b/src/workspace/hover.rs @@ -112,7 +112,7 @@ static WELLKNOWN_DOCS: LazyLock> = LazyLock: HashMap::from([ ( "google.protobuf.Any", - r#"*Any* wellknown type + r#"*google.protobuf.Any* wellknown type --- `Any` contains an arbitrary serialized message along with a URL that describes the type of the serialized message. The JSON representation of an Any value uses the regular representation of the deserialized, embedded message, with an additional field @type which contains the type URL. @@ -128,7 +128,7 @@ message Any { ), ( "google.protobuf.Api", - r#"*Api* well known type + r#"*google.protobuf.Api* well known type --- `Api` is a light-weight descriptor for a protocol buffer service. --- @@ -148,7 +148,7 @@ message Api { ), ( "google.protobuf.BoolValue", - r#"*BoolValue* well known type, Wrapper message for bool + r#"*google.protobuf.BoolValue* well known type, Wrapper message for bool --- The JSON representation for `BoolValue` is JSON `true` and `false` --- @@ -161,7 +161,7 @@ message BoolValue { ), ( "google.protobuf.BytesValue", - r#"*BytesValue* well known type, Wrapper message for bytes + r#"*google.protobuf.BytesValue* well known type, Wrapper message for bytes --- The JSON representation for `BytesValue` is JSON string. --- @@ -174,7 +174,7 @@ message BytesValue { ), ( "google.protobuf.DoubleValue", - r#"*DoubleValue* well known type, Wrapper message for double + r#"*google.protobuf.DoubleValue* well known type, Wrapper message for double --- The JSON representation for `DoubleValue` is JSON number. --- @@ -187,7 +187,7 @@ message DoubleValue { ), ( "google.protobuf.Duration", - r#"*Duration* well known type + r#"*google.protobuf.Duration* well known type --- A Duration represents a signed, fixed-length span of time represented as a count of seconds and fractions of seconds at nanosecond resolution. It is independent of any calendar and concepts like "day" or "month". @@ -204,7 +204,7 @@ message Duration { ), ( "google.protobuf.Empty", - r#"*Empty* well known type + r#"*google.protobuf.Empty* well known type --- A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. The JSON representation for Empty is empty JSON object `{}` @@ -212,7 +212,7 @@ The JSON representation for Empty is empty JSON object `{}` ), ( "google.protobuf.Enum", - r#"*Enum* well known type + r#"*google.protobuf.Enum* well known type --- Enum type definition --- @@ -230,7 +230,7 @@ message Enum { ), ( "google.protobuf.EnumValue", - r#"*EnumValue* well known type + r#"*google.protobuf.EnumValue* well known type --- Enum value definition --- @@ -246,7 +246,7 @@ message EnumValue { ), ( "google.protobuf.Field", - r#"*Field* well known type + r#"*google.protobuf.Field* well known type --- A single field of a message type. --- @@ -268,7 +268,7 @@ message Field { ), ( "google.protobuf.Field.Cardinality", - r#"*Field.Cardinality* well known type + r#"*google.protobuf.Field.Cardinality* well known type --- Whether a field is optional, required, or repeated. --- @@ -285,7 +285,7 @@ enum Cardinality { ), ( "google.protobuf.Field.Kind", - r#"*Field.Kind* well known type + r#"*google.protobuf.Field.Kind* well known type --- Basic field types. --- @@ -317,7 +317,7 @@ enum Kind { ), ( "google.protobuf.FieldMask", - r#"*FieldMask* well known type + r#"*google.protobuf.FieldMask* well known type --- `FieldMask` represents a set of symbolic field paths --- @@ -331,7 +331,7 @@ message FieldMask { ), ( "google.protobuf.FloatValue", - r#"*FloatValue* well known type, Wrapper message for `float` + r#"*google.protobuf.FloatValue* well known type, Wrapper message for `float` --- The JSON representation for `FloatValue` is JSON number. --- @@ -344,7 +344,7 @@ message FloatValue { ), ( "google.protobuf.Int32Value", - r#"*Int32Value* well known type, Wrapper message for `int32` + r#"*google.protobuf.Int32Value* well known type, Wrapper message for `int32` --- The JSON representation for `Int32Value` is JSON number. --- @@ -357,7 +357,7 @@ message Int32Value { ), ( "google.protobuf.Int64Value", - r#"*Int64Value* well known type, Wrapper message for `int64` + r#"*google.protobuf.Int64Value* well known type, Wrapper message for `int64` --- The JSON representation for `Int64Value` is JSON string. --- @@ -370,7 +370,7 @@ message Int64Value { ), ( "google.protobuf.ListValue", - r#"*ListValue* well known type, Wrapper around a repeated field of values + r#"*google.protobuf.ListValue* well known type, Wrapper around a repeated field of values --- The JSON representation for `ListValue` is JSON Array. --- @@ -383,7 +383,7 @@ message Int64Value { ), ( "google.protobuf.Method", - r#"*Method* well known type + r#"*google.protobuf.Method* well known type --- Method represents a method of an api. --- @@ -402,7 +402,7 @@ message Method { ), ( "google.protobuf.Mixin", - r#"*Mixin* well known type + r#"*google.protobuf.Mixin* well known type --- Declares an API Interface to be included in this interface. The including interface must redeclare all the methods from the included interface, but @@ -418,7 +418,7 @@ message Mixin { ), ( "google.protobuf.NullValue", - r#"*NullValue* well known type + r#"*google.protobuf.NullValue* well known type --- `NullValue` is a singleton enumeration to represent the null value for the Value type union. The JSON representation for NullValue is JSON `null`. @@ -432,7 +432,7 @@ enum NullValue { ), ( "google.protobuf.Option", - r#"*Option* well known type + r#"*google.protobuf.Option* well known type --- A protocol buffer option, which can be attached to a message, field, enumeration, etc --- @@ -446,7 +446,7 @@ message Option { ), ( "google.protobuf.SourceContext", - r#"*SourceContext* well known type + r#"*google.protobuf.SourceContext* well known type --- `SourceContext` represents information about the source of a protobuf element, like the file in which it is defined --- @@ -459,7 +459,7 @@ message SourceContext { ), ( "google.protobuf.StringValue", - r#"*StringValue* well known type, Wrapper message for string. + r#"*google.protobuf.StringValue* well known type, Wrapper message for string. --- The JSON representation for `StringValue` is JSON string. --- @@ -472,7 +472,7 @@ message StringValue { ), ( "google.protobuf.Struct", - r#"*Struct* well known type + r#"*google.protobuf.Struct* well known type --- `Struct` represents a structured data value, consisting of fields which map to dynamically typed values. @@ -486,7 +486,7 @@ message Struct { ), ( "google.protobuf.Syntax", - r#"*Syntax* well known type + r#"*google.protobuf.Syntax* well known type --- The syntax in which a protocol buffer element is defined --- @@ -501,7 +501,7 @@ enum Syntax { ), ( "google.protobuf.Timestamp", - r#"*Timestamp* well known type + r#"*google.protobuf.Timestamp* well known type --- `Timestamp` represents a point in time independent of any time zone or calendar, represented as seconds and fractions of seconds at nanosecond resolution in UTC Epoch time --- @@ -515,7 +515,7 @@ message Timestamp { ), ( "google.protobuf.Type", - r#"*Type* well known type + r#"*google.protobuf.Type* well known type --- A protocol buffer message type --- @@ -534,7 +534,7 @@ message Type { ), ( "google.protobuf.UInt32Value", - r#"*UInt32Value* well known type, Wrapper message for `uint32` + r#"*google.protobuf.UInt32Value* well known type, Wrapper message for `uint32` --- The JSON representation for `UInt32Value` is JSON number. --- @@ -547,7 +547,7 @@ message UInt32Value { ), ( "google.protobuf.UInt64Value", - r#"*UInt64Value* well known type, Wrapper message for `uint64` + r#"*google.protobuf.UInt64Value* well known type, Wrapper message for `uint64` --- The JSON representation for `UInt64Value` is JSON string. --- @@ -560,7 +560,7 @@ message UInt64Value { ), ( "google.protobuf.Value", - r#"*Value* well known type + r#"*google.protobuf.Value* well known type --- `Value` represents a dynamically typed value which can be either null, a number, a string, a boolean, a recursive struct value, or a @@ -649,6 +649,7 @@ mod test { state.upsert_file(&b_uri, b.to_owned()); state.upsert_file(&c_uri, c.to_owned()); + assert_yaml_snapshot!(state.hover("com.workspace", "google.protobuf.Any")); assert_yaml_snapshot!(state.hover("com.workspace", "Author")); assert_yaml_snapshot!(state.hover("com.workspace", "int64")); assert_yaml_snapshot!(state.hover("com.workspace", "Author.Address")); diff --git a/src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover-2.snap b/src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover-2.snap index be32ca1..6d2d127 100644 --- a/src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover-2.snap +++ b/src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover-2.snap @@ -1,7 +1,6 @@ --- source: src/workspace/hover.rs -expression: "state.hover(\"com.workspace\", \"int64\")" -snapshot_kind: text +expression: "state.hover(\"com.workspace\", \"Author\")" --- kind: markdown -value: "*int64* builtin type, A 64-bit integer (varint encoding)\n---\nValues of this type range between `-9223372036854775808` and `9223372036854775807`.\nBeware that negative values are encoded as ten bytes on the wire!" +value: "`Author` message or enum type, package: `com.workspace`\n---\nA author is a author" diff --git a/src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover-3.snap b/src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover-3.snap index 8200b12..3694468 100644 --- a/src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover-3.snap +++ b/src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover-3.snap @@ -1,7 +1,6 @@ --- source: src/workspace/hover.rs -expression: "state.hover(\"com.workspace\", \"Author.Address\")" -snapshot_kind: text +expression: "state.hover(\"com.workspace\", \"int64\")" --- kind: markdown -value: "`Author.Address` message or enum type, package: `com.workspace`\n---\nAddress is a Address" +value: "*int64* builtin type, A 64-bit integer (varint encoding)\n---\nValues of this type range between `-9223372036854775808` and `9223372036854775807`.\nBeware that negative values are encoded as ten bytes on the wire!" diff --git a/src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover-4.snap b/src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover-4.snap index 40d58b4..1bef5a4 100644 --- a/src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover-4.snap +++ b/src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover-4.snap @@ -1,7 +1,6 @@ --- source: src/workspace/hover.rs -expression: "state.hover(\"com.workspace\", \"com.utility.Foobar.Baz\")" -snapshot_kind: text +expression: "state.hover(\"com.workspace\", \"Author.Address\")" --- kind: markdown -value: "`Foobar.Baz` message or enum type, package: `com.utility`\n---\nWhat is baz?" +value: "`Author.Address` message or enum type, package: `com.workspace`\n---\nAddress is a Address" diff --git a/src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover-5.snap b/src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover-5.snap index 6ca79f3..3e37a64 100644 --- a/src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover-5.snap +++ b/src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover-5.snap @@ -1,7 +1,6 @@ --- source: src/workspace/hover.rs -expression: "state.hover(\"com.utility\", \"Baz\")" -snapshot_kind: text +expression: "state.hover(\"com.workspace\", \"com.utility.Foobar.Baz\")" --- kind: markdown -value: "`Baz` message or enum type, package: `com.utility`\n---\nWhat is baz?" +value: "`Foobar.Baz` message or enum type, package: `com.utility`\n---\nWhat is baz?" diff --git a/src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover-6.snap b/src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover-6.snap new file mode 100644 index 0000000..79501a2 --- /dev/null +++ b/src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover-6.snap @@ -0,0 +1,6 @@ +--- +source: src/workspace/hover.rs +expression: "state.hover(\"com.utility\", \"Baz\")" +--- +kind: markdown +value: "`Baz` message or enum type, package: `com.utility`\n---\nWhat is baz?" diff --git a/src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover.snap b/src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover.snap index fe89f2c..77b0777 100644 --- a/src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover.snap +++ b/src/workspace/snapshots/protols__workspace__hover__test__workspace_test_hover.snap @@ -1,7 +1,6 @@ --- source: src/workspace/hover.rs -expression: "state.hover(\"com.workspace\", \"Author\")" -snapshot_kind: text +expression: "state.hover(\"com.workspace\", \"google.protobuf.Any\")" --- kind: markdown -value: "`Author` message or enum type, package: `com.workspace`\n---\nA author is a author" +value: "*google.protobuf.Any* wellknown type\n---\n`Any` contains an arbitrary serialized message along with a URL that describes the type of the serialized message.\nThe JSON representation of an Any value uses the regular representation of the deserialized, embedded message, with an additional field @type which contains the type URL.\n---\n```proto\nmessage Any {\n string type_url = 1; // A URL/resource name that uniquely identifies the type of the serialized protocol buffer message\n bytes value = 2; // Must be a valid serialized protocol buffer\n}\n```\n\n"