File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed
snapshots/output/odd_pkg_name_1 Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change 1- # < definition scip-python python package with space 0.1 main/__init__:
1+ # < definition scip-python python package with space 0.1 main/__init__:
22#documentation (module) main
33
44def main ():
5- # ^^^^ definition package with space 0.1 main/main().
5+ # ^^^^ definition package with space 0.1 main/main().
66# documentation ```python
77# > def main(): # -> None:
88# > ```
99 pass
1010
1111main ()
12- #^^^ reference package with space 0.1 main/main().
12+ #^^^ reference package with space 0.1 main/main().
1313
Original file line number Diff line number Diff line change @@ -7,10 +7,21 @@ export class ScipSymbol extends TypescriptScipSymbol {
77 }
88
99 public static override package ( name : string , version : string ) : TypescriptScipSymbol {
10- name = name . replace ( / \. / , '/' ) ;
11- name = name . trim ( ) ;
10+ name = normalizeNameOrVersion ( name ) ;
11+ version = normalizeNameOrVersion ( version ) ;
1212
1313 // @ts -ignore
1414 return new TypescriptScipSymbol ( `scip-python python ${ name } ${ version } ` ) ;
1515 }
1616}
17+
18+ // See https://github.com/sourcegraph/scip/blob/main/scip.proto#L118-L121
19+ function normalizeNameOrVersion ( s : string ) : string {
20+ if ( s === '' ) {
21+ return '.' ;
22+ }
23+ if ( s . indexOf ( ' ' ) === - 1 ) {
24+ return s ;
25+ }
26+ return s . replace ( / / g, ' ' ) ;
27+ }
You can’t perform that action at this time.
0 commit comments