Skip to content

Commit 447e429

Browse files
authored
Merge pull request #66 from cvng/minor-fixes
2 parents 9160453 + 93d2898 commit 447e429

File tree

5 files changed

+17
-5
lines changed

5 files changed

+17
-5
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ members = [
33
"crates/*",
44
"xtask/"
55
]
6+
resolver = "2"
67

78
[workspace.package]
89
rust-version = "1.71"
@@ -17,4 +18,3 @@ triomphe = { version = "0.1.8", default-features = false, features = ["std"] }
1718
[profile.dev.package]
1819
insta.opt-level = 3
1920
similar.opt-level = 3
20-

crates/codegen/src/parser.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
use pg_query_proto_parser::ProtoParser;
22
use quote::quote;
3+
use std::{env, path, path::Path};
34

45
use crate::{
56
get_location::get_location_mod, get_node_properties::get_node_properties_mod,
67
get_nodes::get_nodes_mod, syntax_kind::syntax_kind_mod,
78
};
89

910
pub fn parser_mod(_item: proc_macro2::TokenStream) -> proc_macro2::TokenStream {
10-
let parser = ProtoParser::new("libpg_query/protobuf/pg_query.proto");
11+
let parser = ProtoParser::new(&proto_file_path());
1112
let proto_file = parser.parse();
1213

1314
let syntax_kind = syntax_kind_mod(&proto_file);
@@ -32,3 +33,12 @@ pub fn parser_mod(_item: proc_macro2::TokenStream) -> proc_macro2::TokenStream {
3233
#get_nodes
3334
}
3435
}
36+
37+
fn proto_file_path() -> path::PathBuf {
38+
Path::new(env!("CARGO_MANIFEST_DIR"))
39+
.ancestors()
40+
.nth(2)
41+
.unwrap()
42+
.join("libpg_query/protobuf/pg_query.proto")
43+
.to_path_buf()
44+
}

crates/pg_query_proto_parser/src/proto_parser.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use convert_case::{Case, Casing};
22
use protobuf::descriptor::{field_descriptor_proto::Label, FileDescriptorProto};
33
use protobuf_parse::Parser;
4-
use std::path::Path;
4+
use std::{ffi::OsStr, path::Path};
55

66
use crate::proto_file::{Field, FieldType, Node, ProtoFile, Token};
77

@@ -11,7 +11,7 @@ pub struct ProtoParser {
1111
}
1212

1313
impl ProtoParser {
14-
pub fn new(file_path: &str) -> Self {
14+
pub fn new(file_path: &impl AsRef<OsStr>) -> Self {
1515
let proto_file = Path::new(file_path);
1616
let proto_dir = proto_file.parent().unwrap();
1717

crates/postgres_lsp/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ impl LanguageServer for Backend {
189189

190190
async fn semantic_tokens_range(
191191
&self,
192-
params: SemanticTokensRangeParams,
192+
_: SemanticTokensRangeParams,
193193
) -> Result<Option<SemanticTokensRangeResult>> {
194194
return Ok(None);
195195
}

rust-toolchain.toml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[toolchain]
2+
channel = "nightly"

0 commit comments

Comments
 (0)