This repository was archived by the owner on Oct 15, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +20
-10
lines changed Expand file tree Collapse file tree 5 files changed +20
-10
lines changed Original file line number Diff line number Diff line change @@ -45,9 +45,11 @@ function getTsPathForPylupdate(tool: Tool) {
4545 const matched = tool . args
4646 . join ( ' ' )
4747 . match ( / - t s \s + ( " (?< pathWithSpaces > [ \S \s ] + ) " | (?< path > [ \S ] + ) ) ( \s + | $ ) / ) ;
48- if ( matched ?. groups )
49- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
50- return path . dirname ( matched . groups . pathWithSpaces ?? matched . groups . path ) ;
48+ if ( matched ?. groups ) {
49+ if ( matched . groups . pathWithSpaces )
50+ return path . dirname ( matched . groups . pathWithSpaces ) ;
51+ if ( matched . groups . path ) return path . dirname ( matched . groups . path ) ;
52+ }
5153 return ;
5254}
5355
Original file line number Diff line number Diff line change @@ -82,6 +82,6 @@ async function setToolPath(toolName: SupportedTool) {
8282 const toolUri = await vscode . window . showOpenDialog ( {
8383 canSelectMany : false ,
8484 } ) ;
85- if ( ! toolUri || toolUri . length === 0 ) return ;
85+ if ( ! toolUri || ! toolUri [ 0 ] ) return ;
8686 return new Tool ( toolName ) . updatePath ( toolUri [ 0 ] . fsPath ) ;
8787}
Original file line number Diff line number Diff line change @@ -11,9 +11,12 @@ export function getExtensionPath() {
1111}
1212
1313export function getActiveWorkspaceFolderPath ( ) {
14- if ( vscode . workspace . workspaceFolders )
15- return vscode . workspace . workspaceFolders [ 0 ] . uri . fsPath ;
16- return ;
14+ if (
15+ ! vscode . workspace . workspaceFolders ||
16+ ! vscode . workspace . workspaceFolders [ 0 ]
17+ )
18+ return ;
19+ return vscode . workspace . workspaceFolders [ 0 ] . uri . fsPath ;
1720}
1821
1922export function getActiveDocumentPath ( ) {
Original file line number Diff line number Diff line change @@ -26,7 +26,11 @@ interface PredefinedVariables {
2626
2727class PredefinedVariableProvider implements PredefinedVariables {
2828 get workspaceFolder ( ) {
29- if ( ! vscode . workspace . workspaceFolders ) return '' ;
29+ if (
30+ ! vscode . workspace . workspaceFolders ||
31+ ! vscode . workspace . workspaceFolders [ 0 ]
32+ )
33+ return '' ;
3034 return vscode . workspace . workspaceFolders [ 0 ] . uri . fsPath ;
3135 }
3236
@@ -83,7 +87,7 @@ class PredefinedVariableProvider implements PredefinedVariables {
8387 }
8488
8589 get selectedText ( ) {
86- if ( vscode . workspace . textDocuments . length === 0 ) return '' ;
90+ if ( ! vscode . workspace . textDocuments [ 0 ] ) return '' ;
8791 return vscode . workspace . textDocuments [ 0 ] . getText (
8892 vscode . window . activeTextEditor ?. selection
8993 ) ;
Original file line number Diff line number Diff line change 1010 "strict" : true ,
1111 "noImplicitReturns" : true ,
1212 "noFallthroughCasesInSwitch" : true ,
13- "noUnusedParameters" : true
13+ "noUnusedParameters" : true ,
14+ "noUncheckedIndexedAccess" : true
1415 },
1516 "exclude" : [" node_modules" , " .vscode-test" ]
1617}
You can’t perform that action at this time.
0 commit comments