@@ -90,8 +90,9 @@ export const checkShellConfigPlugin = async () => {
9090 if ( profilePath != null && fs . existsSync ( profilePath ) ) {
9191 const profile = await fsAsync . readFile ( profilePath , "utf8" ) ;
9292
93- const profileContainsSource = profile . includes ( getShellSourceCommand ( shell ) ) ;
94- const profileEndsWithSource = profile . trimEnd ( ) . endsWith ( getShellSourceCommand ( shell ) ) ;
93+ const shellSourceCommand = getShellSourceCommand ( shell ) . trim ( ) ;
94+ const profileContainsSource = profile . includes ( shellSourceCommand ) ;
95+ const profileEndsWithSource = profile . trimEnd ( ) . endsWith ( shellSourceCommand ) ;
9596
9697 if ( ! profileContainsSource ) {
9798 shellsWithoutPlugin . push ( shell ) ;
@@ -278,17 +279,17 @@ export const getShellSourceCommand = (shell: Shell): string => {
278279 case Shell . Bash :
279280 return `[ -f ~/.inshellisense/bash/init.sh ] && source ~/.inshellisense/bash/init.sh` ;
280281 case Shell . Powershell :
281- return `if ( Test-Path '~/.inshellisense/powershell/init.ps1' -PathType Leaf ) { . ~/.inshellisense/powershell/init.ps1 } ` ;
282+ return `if ( Test-Path '~/.inshellisense/powershell/init.ps1' -PathType Leaf ) { . ~/.inshellisense/powershell/init.ps1 }` ;
282283 case Shell . Pwsh :
283- return `if ( Test-Path '~/.inshellisense/pwsh/init.ps1' -PathType Leaf ) { . ~/.inshellisense/pwsh/init.ps1 } ` ;
284+ return `if ( Test-Path '~/.inshellisense/pwsh/init.ps1' -PathType Leaf ) { . ~/.inshellisense/pwsh/init.ps1 }` ;
284285 case Shell . Zsh :
285286 return `[[ -f ~/.inshellisense/zsh/init.zsh ]] && source ~/.inshellisense/zsh/init.zsh` ;
286287 case Shell . Fish :
287288 return `test -f ~/.inshellisense/fish/init.fish && source ~/.inshellisense/fish/init.fish` ;
288289 case Shell . Xonsh :
289290 return `p"~/.inshellisense/xonsh/init.xsh".exists() && source "~/.inshellisense/xonsh/init.xsh"` ;
290291 case Shell . Nushell :
291- return `if ( '~/.inshellisense/nu/init.nu' | path exists ) { source ~/.inshellisense/nu/init.nu } ` ;
292+ return `if ( '~/.inshellisense/nu/init.nu' | path exists ) { source ~/.inshellisense/nu/init.nu }` ;
292293 }
293294 return "" ;
294295} ;
0 commit comments