11use 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 } ;
79use lazy_static:: lazy_static;
810use lsp_types:: {
911 notification:: DidChangeTextDocument , CompletionParams , Diagnostic , DidChangeTextDocumentParams ,
1012 SemanticTokens , SemanticTokensDelta , Url ,
1113} ;
1214use rustc_hash:: FxHashMap ;
1315use wasm_bindgen:: prelude:: wasm_bindgen;
14- use include_dir:: { include_dir, Dir } ;
1516
1617use crate :: {
1718 ast:: {
@@ -136,18 +137,16 @@ pub unsafe fn on_change_doc(req: &str) -> String {
136137
137138pub 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
163161fn 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) ;
0 commit comments