Skip to content

Commit

Permalink
feat: use pkg-config to discover well known types and hover on imports (
Browse files Browse the repository at this point in the history
#53)

A step closer...
  • Loading branch information
coder3101 authored Jan 25, 2025
1 parent c426e1a commit 0f7079b
Show file tree
Hide file tree
Showing 23 changed files with 231 additions and 1,439 deletions.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ hard-xml = "1.36.0"
tempfile = "3.12.0"
serde = { version = "1.0.209", features = ["derive"] }
basic-toml = "0.1.9"
pkg-config = "0.3.31"

[dev-dependencies]
insta = { version = "1.39.0", features = ["yaml"] }
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
## ✨ Features

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

### Hover Information

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

### Rename Symbols

Expand Down
2 changes: 1 addition & 1 deletion protols.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[config]
include_paths = ["sample", "src/workspace/input"]
include_paths = ["src/workspace/input"]
64 changes: 64 additions & 0 deletions sample/everything.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
syntax = "proto3";

// Import Google's Well-Known Types
import "google/protobuf/timestamp.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/struct.proto";
import "google/protobuf/any.proto";

package example;

// Enum example
enum Status {
UNKNOWN = 0;
ACTIVE = 1;
INACTIVE = 2;
}

// Nested message example
message Address {
string street = 1;
string city = 2;
string state = 3;
string zip_code = 4;
}

// Main message example
message Person {
// Scalar types
string name = 1;
int32 age = 2;
bool is_verified = 3;

// Repeated field (array)
repeated string phone_numbers = 4;

// Map example
map<string, string> attributes = 5;

// Enum field
Status status = 6;

// Nested message
Address address = 7;

// Oneof example
oneof contact_method {
string email = 8;
string phone = 9;
}

// Google Well-Known Types
google.protobuf.Timestamp last_updated = 10;
google.protobuf.Duration session_duration = 11;
google.protobuf.Empty metadata = 12;
google.protobuf.Struct extra_data = 13;
google.protobuf.Any any_data = 14;
}

// Service example
service PersonService {
rpc GetPerson(google.protobuf.Empty) returns (Person);
rpc UpdatePerson(Person) returns (google.protobuf.Empty);
}
159 changes: 0 additions & 159 deletions sample/google/protobuf/any.proto

This file was deleted.

Loading

0 comments on commit 0f7079b

Please sign in to comment.