File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
packages/jupyterlab-lsp/src Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change
1
+ import { expect } from 'chai' ;
2
+
3
+ import { uris_equal } from './utils' ;
4
+
5
+ describe ( 'uris_equal' , ( ) => {
6
+ it ( 'should workaround Windows paths/Pyright issues' , ( ) => {
7
+ const result = uris_equal (
8
+ 'file:///d%3A/a/jupyterlab-lsp/jupyterlab-lsp/atest/output/windows_39_4/home/n%C3%B6te%20b%C3%B2%C3%B3ks/example.py' ,
9
+ 'file:///d:/a/jupyterlab-lsp/jupyterlab-lsp/atest/output/windows_39_4/home/n%C3%B6te%20b%C3%B2%C3%B3ks/example.py'
10
+ ) ;
11
+ expect ( result ) . to . equal ( true ) ;
12
+ } ) ;
13
+ } ) ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { PageConfig } from '@jupyterlab/coreutils';
2
2
import { ReadonlyJSONObject , ReadonlyJSONValue } from '@lumino/coreutils' ;
3
3
import mergeWith from 'lodash.mergewith' ;
4
4
5
- const RE_PATH_ANCHOR = / ^ f i l e : \/ \/ ( [ ^ \/ ] + | \/ [ A - Z ] : ) / ;
5
+ const RE_PATH_ANCHOR = / ^ f i l e : \/ \/ ( [ ^ \/ ] + | \/ [ a - z A - Z ] (?: : | % 3 A ) ) / ;
6
6
7
7
export async function sleep ( timeout : number ) {
8
8
return new Promise < void > ( resolve => {
@@ -142,7 +142,11 @@ export function is_win_path(uri: string) {
142
142
* lowercase the drive component of a URI
143
143
*/
144
144
export function normalize_win_path ( uri : string ) {
145
- return uri . replace ( RE_PATH_ANCHOR , it => it . toLowerCase ( ) ) ;
145
+ // Pyright encodes colon on Windows, see:
146
+ // https://github.com/krassowski/jupyterlab-lsp/pull/587#issuecomment-844225253
147
+ return uri . replace ( RE_PATH_ANCHOR , it =>
148
+ it . replace ( '%3A' , ':' ) . toLowerCase ( )
149
+ ) ;
146
150
}
147
151
148
152
export function uri_to_contents_path ( child : string , parent ?: string ) {
You can’t perform that action at this time.
0 commit comments