File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
crates/oxc_language_server/src Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 1- use std:: { path:: { Path , PathBuf } , str:: FromStr } ;
1+ use std:: {
2+ path:: { Path , PathBuf } ,
3+ str:: FromStr ,
4+ } ;
25
36use percent_encoding:: AsciiSet ;
47use tower_lsp_server:: lsp_types:: Uri ;
58
69fn path_to_uri ( path : & PathBuf ) -> Uri {
710 let path_str = normalize_path_with_utf8_percent_encode ( path) ;
8- Uri :: from_str ( & format ! ( "file://{}" , path_str. to_string_lossy( ) ) ) . expect ( "Failed to create URI from path" )
11+ Uri :: from_str ( & format ! ( "file://{}" , path_str. to_string_lossy( ) ) )
12+ . expect ( "Failed to create URI from path" )
913}
1014
1115const ASCII_SET : AsciiSet = percent_encoding:: NON_ALPHANUMERIC . remove ( b'.' ) ;
@@ -28,7 +32,10 @@ pub fn normalize_path_with_utf8_percent_encode<P: AsRef<Path>>(path: P) -> PathB
2832 }
2933 std:: path:: Component :: Normal ( part) => {
3034 // Normal components are added to the path
31- result. push ( percent_encoding:: utf8_percent_encode ( & part. to_str ( ) . unwrap ( ) , & ASCII_SET ) . to_string ( ) ) ;
35+ result. push (
36+ percent_encoding:: utf8_percent_encode ( & part. to_str ( ) . unwrap ( ) , & ASCII_SET )
37+ . to_string ( ) ,
38+ ) ;
3239 }
3340 _ => { }
3441 }
@@ -42,7 +49,6 @@ mod test {
4249
4350 use crate :: uri_ext:: path_to_uri;
4451
45-
4652 #[ test]
4753 fn test_path_to_uri ( ) {
4854 let path = PathBuf :: from ( "/some/path/to/file.txt" ) ;
You can’t perform that action at this time.
0 commit comments