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__:
2
2
#documentation (module) main
3
3
4
4
def main ():
5
- # ^^^^ definition package with space 0.1 main/main().
5
+ # ^^^^ definition package with space 0.1 main/main().
6
6
# documentation ```python
7
7
# > def main(): # -> None:
8
8
# > ```
9
9
pass
10
10
11
11
main ()
12
- #^^^ reference package with space 0.1 main/main().
12
+ #^^^ reference package with space 0.1 main/main().
13
13
Original file line number Diff line number Diff line change @@ -7,10 +7,21 @@ export class ScipSymbol extends TypescriptScipSymbol {
7
7
}
8
8
9
9
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 ) ;
12
12
13
13
// @ts -ignore
14
14
return new TypescriptScipSymbol ( `scip-python python ${ name } ${ version } ` ) ;
15
15
}
16
16
}
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