Skip to content

Commit 5618f91

Browse files
committed
fix: fmt
1 parent 5c80882 commit 5618f91

File tree

7 files changed

+27
-37
lines changed

7 files changed

+27
-37
lines changed

.github/workflows/npmpkg.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
name: Publish Package to npmjs
22
on:
3-
push:
4-
branches:
5-
- master
6-
- feat/npm_pkg
3+
push:
4+
tags:
5+
- 'wasm/*'
76
jobs:
87
build:
98
runs-on: ubuntu-latest

src/ast/node/pkg.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,11 @@ impl Node for UseNode {
7777
ctx.push_semantic_token(v.range, SemanticTokenType::NAMESPACE, 0);
7878
}
7979
#[cfg(target_arch = "wasm32")]
80-
if crate::lsp::wasm::PLLIB_DIR.get_file(path.with_extension("pi")).is_some() {
81-
return Ok(Default::default());
80+
if crate::lsp::wasm::PLLIB_DIR
81+
.get_file(path.with_extension("pi"))
82+
.is_some()
83+
{
84+
return Ok(Default::default());
8285
}
8386
if !path.with_extension("pi").exists() {
8487
let mut path = path.with_extension("");

src/lsp/wasm.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
use std::{
22
borrow::Borrow,
33
cell::RefCell,
4-
sync::{Arc, Mutex}, fmt::format,
4+
fmt::format,
5+
sync::{Arc, Mutex},
56
};
67

8+
use include_dir::{include_dir, Dir};
79
use lazy_static::lazy_static;
810
use lsp_types::{
911
notification::DidChangeTextDocument, CompletionParams, Diagnostic, DidChangeTextDocumentParams,
1012
SemanticTokens, SemanticTokensDelta, Url,
1113
};
1214
use rustc_hash::FxHashMap;
1315
use wasm_bindgen::prelude::wasm_bindgen;
14-
use include_dir::{include_dir, Dir};
1516

1617
use crate::{
1718
ast::{
@@ -136,18 +137,16 @@ pub unsafe fn on_change_doc(req: &str) -> String {
136137

137138
pub static PLLIB_DIR: Dir = include_dir!("./planglib");
138139

139-
fn add_file(db: &mut Database, docs: Arc<Mutex<RefCell<MemDocs>>>, fpath:&str,content:&str) {
140+
fn add_file(db: &mut Database, docs: Arc<Mutex<RefCell<MemDocs>>>, fpath: &str, content: &str) {
140141
// include!(real_path);
141142
// log::error!("add file: {}", fpath);
142-
docs.lock().unwrap().borrow_mut().insert(
143-
db,
144-
fpath.into(),
145-
content.into(),
146-
fpath.into(),
147-
);
143+
docs.lock()
144+
.unwrap()
145+
.borrow_mut()
146+
.insert(db, fpath.into(), content.into(), fpath.into());
148147
}
149148

150-
fn add_fill_rec(db: &mut Database, docs: Arc<Mutex<RefCell<MemDocs>>>, dir:&Dir) {
149+
fn add_fill_rec(db: &mut Database, docs: Arc<Mutex<RefCell<MemDocs>>>, dir: &Dir) {
151150
dir.files().for_each(|f| {
152151
let path = f.path();
153152
f.contents_utf8().map(|x| {
@@ -157,13 +156,12 @@ fn add_fill_rec(db: &mut Database, docs: Arc<Mutex<RefCell<MemDocs>>>, dir:&Dir)
157156
dir.dirs().for_each(|d| {
158157
add_fill_rec(db, docs.clone(), d);
159158
});
160-
161159
}
162160

163161
fn add_pl_libs(db: &mut Database, docs: Arc<Mutex<RefCell<MemDocs>>>) {
164162
for entry in PLLIB_DIR.dirs() {
165163
let path = entry.path();
166-
if path.starts_with("thirdparty"){
164+
if path.starts_with("thirdparty") {
167165
continue;
168166
}
169167
add_fill_rec(db, docs.clone(), entry);

src/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ use std::{
2121
use ast::compiler::{self, ActionType, HashOptimizationLevel};
2222
use clap::{CommandFactory, Parser, Subcommand};
2323
use db::Database;
24-
use lsp::{
25-
mem_docs::{self, MemDocsInput},
26-
};
24+
use lsp::mem_docs::{self, MemDocsInput};
2725

2826
#[cfg(not(target_arch = "wasm32"))]
2927
use lsp::start_lsp;

src/nomparser/program.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,9 @@ use nom::{
66

77
use crate::nomparser::Span;
88
use crate::{
9+
ast::node::types::TypedIdentifierNode,
910
ast::range::Range,
10-
ast::{
11-
diag::ErrorCode,
12-
fmt::FmtBuilder,
13-
node::{
14-
types::PointerTypeNode,
15-
},
16-
},
17-
ast::{node::types::TypedIdentifierNode},
11+
ast::{diag::ErrorCode, fmt::FmtBuilder, node::types::PointerTypeNode},
1812
};
1913

2014
use super::{implement::impl_def, macro_parse::macro_parser, union::union_stmt, *};

src/nomparser/statement.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,7 @@ use crate::{
1111
ast::node::ret::RetNode,
1212
ast::range::Range,
1313
ast::tokens::TokenType,
14-
ast::{
15-
diag::ErrorCode,
16-
node::{
17-
global::GlobalNode,
18-
},
19-
},
14+
ast::{diag::ErrorCode, node::global::GlobalNode},
2015
};
2116
use internal_macro::{test_parser, test_parser_error};
2217

src/utils/read_config.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ pub fn get_config(db: &dyn Db, entry: SourceProgram) -> Result<Config, String> {
118118
// let d = crate::lsp::wasm::PLLIB_DIR;
119119
let mut deps = BTreeMap::<String, Dependency>::default();
120120
for path in crate::lsp::wasm::PLLIB_DIR.dirs() {
121-
if !path.contains("thirdparty") {
121+
if !path.contains("thirdparty") {
122122
let dep = Dependency {
123123
path: crate::utils::canonicalize(path.path())
124124
.unwrap()
@@ -127,7 +127,10 @@ pub fn get_config(db: &dyn Db, entry: SourceProgram) -> Result<Config, String> {
127127
.to_string(),
128128
..Default::default()
129129
};
130-
deps.insert(path.path().file_name().unwrap().to_str().unwrap().into(), dep);
130+
deps.insert(
131+
path.path().file_name().unwrap().to_str().unwrap().into(),
132+
dep,
133+
);
131134
}
132135
}
133136
config.deps = Some(deps);

0 commit comments

Comments
 (0)