Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Powershell: Can't get the correct profile path #18

Closed
Gaojianli opened this issue Nov 7, 2023 · 2 comments · Fixed by #22
Closed

Powershell: Can't get the correct profile path #18

Gaojianli opened this issue Nov 7, 2023 · 2 comments · Fixed by #22
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Gaojianli
Copy link

Describe the bug
Try to run inshellisense bind in powershell on macOS and got following error:

$ inshellisense bind
Select your desired shell for keybinding creation
  bash
  zsh
  fish
> powershell
  pwsh
node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[Error: ENOENT: no such file or directory, open '/Users/username/Documents/WindowsPowershell/Microsoft.PowerShell_profile.ps1'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/username/Documents/WindowsPowershell/Microsoft.PowerShell_profile.ps1'
}

To Reproduce
Steps to reproduce the behavior:

  1. Open powershell on macOS
  2. Run inshellisense bind

Expected behavior
The correct profile path is ~/.config/powershell/Microsoft.PowerShell_profile.ps1

$ file $PROFILE                                                  
/Users/user/.config/powershell/Microsoft.PowerShell_profile.ps1: ASCII text

Environment

  • OS: macOS
  • Output of inshellisense --version: 0.0.1-rc.1
  • Nodejs Version: 21.1.0

Additional context
Add any other context about the problem here.

@Gaojianli Gaojianli added the bug Something isn't working label Nov 7, 2023
@Gaojianli
Copy link
Author

After manually insert the key-bindings into the profile,:

if(Test-Path '/Users/username/.inshellisense/key-bindings-pwsh.ps1' -PathType Leaf){. /Users/username/.inshellisense/key-bindings-pwsh.ps1}

I got another error:

node:internal/modules/cjs/loader:1147
  throw err;
  ^

Error: Cannot find module '/Users/username/\AppData\Roaming\npm\node_modules\@microsoft\inshellisense\build\index.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

It seems that there are some hard-code paths for windows...

@Delta456
Copy link

Delta456 commented Nov 7, 2023

Powershell and pwsh are completely different. Powershell is Windows only and pwsh is cross-platform.

@cpendery cpendery self-assigned this Nov 7, 2023
@cpendery cpendery added this to the November 2023 milestone Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants