Skip to content

Commit 0f7079b

Browse files
authored
feat: use pkg-config to discover well known types and hover on imports (#53)
A step closer...
1 parent c426e1a commit 0f7079b

23 files changed

+231
-1439
lines changed

Cargo.lock

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ hard-xml = "1.36.0"
2727
tempfile = "3.12.0"
2828
serde = { version = "1.0.209", features = ["derive"] }
2929
basic-toml = "0.1.9"
30+
pkg-config = "0.3.31"
3031

3132
[dev-dependencies]
3233
insta = { version = "1.39.0", features = ["yaml"] }

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
## ✨ Features
1313

1414
-**Code Completion**: Auto-complete messages, enums, and keywords in your `.proto` files.
15-
-**Diagnostics**: Syntax errors detected with the tree-sitter parser.
15+
-**Diagnostics**: Syntax errors and import error detected with the tree-sitter parser.
1616
-**Document Symbols**: Navigate and view all symbols, including messages and enums.
1717
-**Code Formatting**: Format `.proto` files using `clang-format` for a consistent style.
1818
-**Go to Definition**: Jump to the definition of symbols like messages or enums.
@@ -138,7 +138,7 @@ Jump directly to the definition of any custom symbol, including those in other f
138138

139139
### Hover Information
140140

141-
Hover over any symbol to get detailed documentation and comments associated with it. This works seamlessly across different packages and namespaces.
141+
Hover over any symbol or imports to get detailed documentation and comments associated with it. This works seamlessly across different packages and namespaces.
142142

143143
### Rename Symbols
144144

protols.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[config]
2-
include_paths = ["sample", "src/workspace/input"]
2+
include_paths = ["src/workspace/input"]

sample/everything.proto

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
syntax = "proto3";
2+
3+
// Import Google's Well-Known Types
4+
import "google/protobuf/timestamp.proto";
5+
import "google/protobuf/duration.proto";
6+
import "google/protobuf/empty.proto";
7+
import "google/protobuf/struct.proto";
8+
import "google/protobuf/any.proto";
9+
10+
package example;
11+
12+
// Enum example
13+
enum Status {
14+
UNKNOWN = 0;
15+
ACTIVE = 1;
16+
INACTIVE = 2;
17+
}
18+
19+
// Nested message example
20+
message Address {
21+
string street = 1;
22+
string city = 2;
23+
string state = 3;
24+
string zip_code = 4;
25+
}
26+
27+
// Main message example
28+
message Person {
29+
// Scalar types
30+
string name = 1;
31+
int32 age = 2;
32+
bool is_verified = 3;
33+
34+
// Repeated field (array)
35+
repeated string phone_numbers = 4;
36+
37+
// Map example
38+
map<string, string> attributes = 5;
39+
40+
// Enum field
41+
Status status = 6;
42+
43+
// Nested message
44+
Address address = 7;
45+
46+
// Oneof example
47+
oneof contact_method {
48+
string email = 8;
49+
string phone = 9;
50+
}
51+
52+
// Google Well-Known Types
53+
google.protobuf.Timestamp last_updated = 10;
54+
google.protobuf.Duration session_duration = 11;
55+
google.protobuf.Empty metadata = 12;
56+
google.protobuf.Struct extra_data = 13;
57+
google.protobuf.Any any_data = 14;
58+
}
59+
60+
// Service example
61+
service PersonService {
62+
rpc GetPerson(google.protobuf.Empty) returns (Person);
63+
rpc UpdatePerson(Person) returns (google.protobuf.Empty);
64+
}

sample/google/protobuf/any.proto

Lines changed: 0 additions & 159 deletions
This file was deleted.

0 commit comments

Comments
 (0)