Giter Site home page Giter Site logo

microsoft / inshellisense Goto Github PK

View Code? Open in Web Editor NEW
8.1K 23.0 173.0 5.12 MB

IDE style command line auto complete

License: MIT License

JavaScript 1.97% PowerShell 0.63% Shell 13.57% TypeScript 81.65% Xonsh 0.92% Nushell 1.25%
autocomplete bash cli fish linux macos powershell pwsh terminal windows zsh nushell xonsh

inshellisense's Introduction

inshellisense

inshellisense provides IDE style autocomplete for shells. It's a terminal native runtime for autocomplete which has support for 600+ command line tools. inshellisense supports Windows, Linux, & macOS.

demo of inshellisense working

Getting Started

Requirements

  • Node.js 20.X, 18.X, 16.X (16.6.0 >=)

Installation

npm install -g @microsoft/inshellisense

Quickstart

After completing the installation, you can run is to start the autocomplete session for your desired shell. Additionally, inshellisense is also aliased under inshellisense after installation.

Shell Plugin

If you'd like to automatically start inshellisense when you open your shell, run the respective command for your shell. After running the command, inshellisense will automatically open when you start any new shell session:

# bash
is init bash >> ~/.bashrc

# zsh
is init zsh >> ~/.zshrc

# fish
is init fish >> ~/.config/fish/config.fish

# pwsh
is init pwsh >> $profile

# powershell
is init powershell >> $profile

# xonsh
is init xonsh >> ~/.xonshrc

# nushell
is init nu >> $nu.env-path

Usage

Action Command Description
Start is Start inshellisense session on the current shell
Stop exit Stop inshellisense session on the current shell
Check If Inside Inshellisense Session is -c Check if shell inside inshellisense session

Keybindings

All other keys are passed through to the shell. The keybindings below are only captured when the inshellisense suggestions are visible, otherwise they are passed through to the shell as well. These can be customized in the config.

Action Keybinding
Accept Current Suggestion tab
View Next Suggestion
View Previous Suggestion
Dismiss Suggestions esc

Integrations

inshellisense supports the following shells:

Configuration

All configuration is done through a toml file. You can create this file at ~/.inshellisenserc or, for XDG compliance, at ~/.config/inshellisense/rc.toml. The JSON schema for the configuration file can be found here.

Keybindings

You can customize the keybindings for inshellisense by adding a bindings section to your config file. The following is the default configuration for the keybindings:

[bindings.acceptSuggestion]
key = "tab"
# shift and tab are optional and default to false
shift = false
ctrl = false

[bindings.nextSuggestion]
key = "down"

[bindings.previousSuggestion]
key = "up"

[bindings.dismissSuggestions]
key = "escape"

Key names are matched against the Node.js keypress events.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

inshellisense's People

Contributors

alanhg avatar cpendery avatar dependabot[bot] avatar life2015 avatar naquiroz avatar rsteube avatar russelldavis avatar somebodyawesome-dev avatar xl4624 avatar zyoshoka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

inshellisense's Issues

Autocompletion for filename does not go into subfolders

Normally, you would be able to use the TAB key to autocomplete file names and go deeper into the directory structure such as:

ls f[TAB] => ls foo/b[TAB] => ls foo/bar/[TAB]

When using 'cd' this capability no longer works.

To Reproduce
Steps to reproduce the behavior:
Given folder structure foo/bar/myfile.txt

  1. CTRL-A
  2. cd f
  3. Press TAB
  4. shows: cd foo
  5. Press TAB again
  6. Does not go down into folder structure

Expected behavior
A clear and concise description of what you expected to happen.

Environment

  • OS: Windows, Powershell
  • Output of inshellisense --version: 0.0.1-rc.1
  • Nodejs Version: 20.9.0

get error after excute `inshellisense bind`

Describe the bug
A clear and concise description of what the bug is.
image

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Environment

  • OS: [e.g. iOS] macOS
  • Output of inshellisense --version: 0.0.1-rc.2
  • Nodejs Version: [e.g. 20.9.0] v16.19.0

Additional context
Add any other context about the problem here.

Provide native executable

Is your feature request related to a problem? Please describe.
I use asdf to manage my node versions. I want to have inshellisense available across all of my versions. As it stands, I have to run npm install -g @microsoft/inshellisense for each version of node that I install. It'd be easer if you used bun or similar to provide a native executable that I could use independently of my current node runtimes.

Describe the solution you'd like
I want to be able to run inshellisense no matter which version of node that is currently on my path.

Describe alternatives you've considered
npx inshellisense

Additional context
None.

Unable to autocomplete a git command

Describe the bug
Inshellisense is unable to autocomplete a git command.

To Reproduce
Start is (with is --shell bash), and try typing up a git command, such as git log --graph --decorate --pretty=oneline --abbrev-commit --all

Expected behavior
Currently, when I type g, the only option is --grep. d offers no options. p offers --patch. a offers --all.
This should be able to find all the options that git (or any command) offers.

Environment

  • OS: Xubuntu 22.04.1
  • Output of inshellisense --version: 0.0.1-rc.1
  • Nodejs Version: v20.6.1

Tryin to use it with nvm on Windows throws "SyntaxError: Unexpected reserved word"

Describe the bug
Tryin to use it with nvm on Windows throws:
file:///C:/Users/User/AppData/Roaming/nvm/v12.22.12/node_modules/@microsoft/inshellisense/build/index.js:13
.version(await getVersion(), "-v, --version", "output the current version")
^^^^^

SyntaxError: Unexpected reserved word
←[90m at Loader.moduleStrategy (internal/modules/esm/translators.js:140:18)←[39m
←[90m at async link (internal/modules/esm/module_job.js:42:21)←[39m

To Reproduce
Steps to reproduce the behavior:

  1. Open cmd
  2. Install npm install -g @microsoft/inshellisense
  3. Run inshellisense bind
  4. See error

Expected behavior
I expect to not get an error

Environment

  • OS: Microsoft Windows [Version 10.0.19045.3570]
  • Output of inshellisense --version: same output as in 'Describe the bug' section
  • Nodejs Version: [v12.22.12]

Git bash for windows throws an Ink exception

Describe the bug
Running is -s bash in a git bash for windows terminal, throws the exception

 ERROR Raw mode is not supported on the current process.stdin, which Ink uses
       as input stream by default.
       Read about how to prevent this error on
       https://github.com/vadimdemedes/ink/#israwmodesupported

To Reproduce
Steps to reproduce the behavior:

  1. Start a git bash terminal
  2. Run is -s bash
  3. See error

Expected behavior
Inshellisense launches as expected.

Environment

  • OS: Windows 10
  • Output of inshellisense --version: 0.0.1-rc.4
  • Nodejs Version: [18.16.0]

Ubuntu WSL error

Describe the bug
When I attempt to run inshellisense, I receive the following error:
/usr/local/lib/node_modules/@microsoft/inshellisense/build/index.js:5
import { Command } from "commander";
^

SyntaxError: Unexpected token {
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

To Reproduce
Steps to reproduce the behavior:
Run any of these commands:
inshellisense
inshellisense bind
sudo inshellisense bind
inshellisense --shell bash

Expected behavior
A clear and concise description of what you expected to happen.
It runs

Environment

  • OS: Windows 10 22H2 w/ WSL running Ubuntu 20.04.6 LTS
  • Output of inshellisense --version: Same error as above, but installation suggests: + @microsoft/[email protected]
  • Nodejs Version: [e.g. 20.9.0] v10.19.0

WSL version: 1.2.5.0
Kernel version: 5.15.90.1
WSLg version: 1.0.51
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.3570

Additional context
Add any other context about the problem here.
I installed npm fresh to be able to install inshellisense. The first attempt to install inshellisense led me to permissions errors, so I redid the command with sudo. This is the installation output (it looks like I might be missing some requisite libraries in my default WSL instance?):

sudo npm install -g @microsoft/inshellisense
/usr/local/bin/inshellisense -> /usr/local/lib/node_modules/@microsoft/inshellisense/build/index.js
/usr/local/bin/is -> /usr/local/lib/node_modules/@microsoft/inshellisense/build/index.js

[email protected] postinstall /usr/local/lib/node_modules/@microsoft/inshellisense/node_modules/protobufjs
node scripts/postinstall

npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.17.0 || ^14.13 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=16"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=14.16"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=14.16"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">= 14"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for @withfig/[email protected]: wanted: {"node":">=16"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: @withfig/[email protected]
npm WARN notsup Unsupported engine for @withfig/[email protected]: wanted: {"node":">=14"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: @withfig/[email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.20.0 || ^14.13.1 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.20.0 || ^14.13.1 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=14.16"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.20.0 || ^14.13.1 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=14.16"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.20.0 || ^14.13.1 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.20.0 || ^14.13.1 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for @alcalzone/[email protected]: wanted: {"node":">=14.13.1"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: @alcalzone/[email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=14.16"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.20.0 || ^14.13.1 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":"^12.20.0 || ^14.13.1 || >=16.0.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]

Aliases do not seem to work for zsh

Is your feature request related to a problem? Please describe.
Yes. I tried setting up aliases (like alias rootdir="/") but then cant use it.

Describe the solution you'd like
aliases should work just like vanilla zsh.

Describe alternatives you've considered
I do not have one.

Piping into another command - inshellisense does not work on that other command

Is your feature request related to a problem? Please describe.
I want to use Inshellisense on multiple commands when constructing more complex command line invocations that use pipes. For example

ls | cat -

should bring up the options for the cat command. But I don't get any options, just a list of filenames, which is useless, as I am piping into cat and don't need to supply a filename.

Describe the solution you'd like

ls | cat -

should bring up the options for the cat command

Ctrl+a did not activate the prompt function, but only selected the command in PowerShell

Ctrl+a did not activate the prompt function, but only selected the command in PowerShell

To Reproduce
Steps to reproduce the behavior:

  1. execute is bind
  2. select powershell and press 'enter'
  3. type git and press Ctrl+a
  4. did not activate the prompt function, but only selected the command git

Expected behavior
active the prompt function for command git

Environment

  • OS: [Windows 10]
  • Output of inshellisense --version: 0.0.1-rc.4
  • Nodejs Version: [v16.20.2]

Additional context
it worked normally via executing is and entering the session.
image

repeat suggests when use Hyper terminal with ZSH

Describe the bug
When you write a command, the options start to be repeated many times in the console.
In default terminal of mac, work correctly.

To Reproduce
Any command

Expected behavior
A clear and concise description of what you expected to happen.

Environment

  • OS: [MACOS Sonoma 14.1]
  • Output of inshellisense --version: 0.0.1-rc.4
  • Nodejs Version: [18.18.2]

Additional context
Add any other context about the problem here.

[BUG] Arrow keys wont work

Describe the bug
Arrow keys wont work

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Install 'npm install -g @microsoft/inshellisense'
  3. execute 'inshellisense bind'
  4. select bash
  5. Enter some commands
  6. use arrow up or arrow down
  7. Nothing happens

Expected behavior

 if (key.upArrow) {
    setSelectionIdx(Math.max(0, selectionIdx - 1));
}
else if (key.downArrow) {
    setSelectionIdx(Math.min(availableShells.length - 1, selectionIdx + 1));
}

Self-explanatory.I think setSelectionIdx will not executed, i dont know..

Environment

  • OS: Debian 12, Linux my.fruit 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 GNU/Linux
  • Output of inshellisense --version: 0.0.1-rc.4
  • Nodejs Version: node -v (v18.13.0), npm -v (9.2.0)

Powershell: 'cd' does not show proper file suggestions

Using Powershell, when trying to change directory using 'cd', it only shows the following suggestions:
../

~
Instead of showing all folders available.

However, when using a 'git add' command, it will show all files in current directory.

Cannot find module when press ctrl+a to tigger completion

Describe the bug
The prompt failed to find its dependencies to launch. When I use Ctrl+A to trigger the completion, it raises such errors.

node:internal/modules/cjs/loader:1051
  throw err;
  ^                                                                                                                     
Error: Cannot find module 'C:\Users\asddf\AppData\Roaming\npm\node_modules\@microsoft\inshellisense\build\index.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
    at Module._load (node:internal/modules/cjs/loader:901:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v20.9.0

To Reproduce
After installation, press ctrl+a and it raises the errors.

Expected behavior
proper completion

Environment

  • OS: windows 11
  • Output of inshellisense --version: 0.0.1-rc.3
  • Nodejs Version: v20.9.0

Additional context
I use scoop to install nodejs-lts package, so the installation path may differ from the normal installation.

❯ which npm
C:/Users/asddf/scoop/apps/nodejs-lts/current/bin/npm.cmd
❯ which inshellisense
C:/Users/asddf/scoop/apps/nodejs-lts/current/bin/inshellisense.cmd

Error: spawn pwsh ENOENT

Describe the bug
When I go to enter a command I get a crash Error: spawn pwsh ENOENT.

To Reproduce

  1. Type CTRL+A
  2. Type any command and hit enter.

Expected behavior
I expect the command to run properly.

Environment

  • OS: Windows 11 23H2
  • Output of inshellisense --version: 0.0.1-rc.4
  • Nodejs Version: v21.1.0

Additional context
Add any other context about the problem here.

This is my D:\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

oh-my-posh --init --shell pwsh --config D:\config.json | Invoke-Expression

# Import the Chocolatey Profile that contains the necessary code to enable
# tab-completions to function for `choco`.
# Be aware that if you are missing these lines from your profile, tab completion
# for `choco` will not function.
# See https://ch0.co/tab-completion for details.

$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"

if (Test-Path($ChocolateyProfile)) {
  Import-Module "$ChocolateyProfile"
}

if(Test-Path 'D:\.inshellisense\key-bindings-pwsh.ps1' -PathType Leaf){. D:\.inshellisense\key-bindings-pwsh.ps1}

The output

> git sta
 tjaacks   ~                                                                                 in pwsh at 21:49:05      throw er; // Unhandled 'error' event
      ^

Error: spawn pwsh ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:286:19)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:292:12)
    at onErrorNT (node:internal/child_process:484:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawn pwsh',
  path: 'pwsh',
  spawnargs: [ '-c', 'git sta' ]
}

Node.js v21.1.0

UI/UX is bad

Is your feature request related to a problem? Please describe.
UX is bad, when we see an option, we usually press Enter, not tab due to the UI

Describe the solution you'd like
I think it is better to make the unfinished part is gray and hint user this command is not finished, and use tab to choose the result
image
image

Describe alternatives you've considered
not showing the option list, just gray letters for hint to press tab to fulfill

Additional context
N/A

Generators don't seem to work

I tried to get the most basic generator working in pwsh but no suggestions are being shown. Since dotnet package add is also using generator, I thought I will test that but no dynamic suggestions for package is being shown. So, it does not appear to work at all.

inshellisense: 0.0.1-rc.3
node: v18.18.0

does not work on ubuntu 22.04 + bash: SyntaxError: Unexpected reserved word

Describe the bug

sudo apt install npm
sudo npm install -g @microsoft/inshellisense
▶ inshellisense --shell bash
file:///usr/local/lib/node_modules/@microsoft/inshellisense/build/index.js:14
    .version(await getVersion(), "-v, --version", "output the current version")
             ^^^^^

SyntaxError: Unexpected reserved word
    at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18)
    at async link (internal/modules/esm/module_job.js:42:21)

Environment

  • OS: ubuntu 22.04
  • Output of inshellisense --version: it crashes
  • Nodejs Version: v12.22.9

Compatible with Sharship

Is your feature request related to a problem? Please describe.
when inshellisense enabled, starship's prompt disappeared.

Describe the solution you'd like
keep both inshellisense's great completion support and beautiful starship's useful prompt.

Describe alternatives you've considered
i donot have any alternative.

Additional context
mainly in MacOS, but it could be reproduct on my linux terminal and pd windows vm

Not support `chcp 936`

Describe the bug

if the $profile contains chcp 936, it will be get a error from terminal

node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[Error: ENOENT: no such file or directory, mkdir 'D:\xxxxxxx\src\�����ҳ: 936
C:\Users\xxxxxx\Documents\PowerShell'] {
  errno: -4058,
  code: 'ENOENT',
  syscall: 'mkdir',
  path: 'D:\\xxxxxxxxxxxxx\\src\\�����ҳ: 936\r\n' +
    'C:\\Users\\xxxxxxxxxxxxx\\Documents\\PowerShell'
}

Node.js v18.16.1

Expected behavior
No error

Environment

  • OS: Windows 11
  • Output of inshellisense --version: 0.0.1-rc.3
  • Nodejs Version: v18.16.1

Additional context
Add any other context about the problem here.

Stop working when typing

Describe the bug
Typing something, then cannot type anymore.

To Reproduce
Steps to reproduce the behavior:

  1. type gcc lab2/5.2.c -
  2. cannot type anymore

Expected behavior
Typing something, then cannot type anymore.

Environment

  • OS: Windows 22621.2506
  • Output of inshellisense --version: 0.0.1-rc.4
  • Nodejs Version: v20.9.0

doesn't support scrolling through older commands

Describe the bug
I cannot scroll through the older commands used by me

To Reproduce

  • Type one command
  • Type another command
  • Try accessing the previous command or older ones by using keys

Expected behavior
To be able to see all previous commands used, like in zsh:

image

Environment

  • OS: Pop OS
  • Output of inshellisense --version: 0.0.1-rc.1
  • Nodejs Version: 9.8.1

Additional context
Add any other context about the problem here.

PowerShell: The 'cd' command does not change directory

When running inshellisence, doing a 'cd [a_folder]' will not change directory properly even if folder exist.

And using the 'cd' suggestions of "../" will not work either

Steps to reproduce the behavior:

  1. start inshellisense (manually or through the binding)
  2. pwd
  3. cd ..
  4. pwd
  5. Directory is the same, should not.

Support PSReadLine

Is your feature request related to a problem? Please describe.
I want PSReadLine when use inshellisense --shell pwsh enter the inshellisense environment.

Describe the solution you'd like
I want all the keyboard shortcut from PSReadLine back.

Describe alternatives you've considered
N/A

Additional context
N/A

Unclear whether inshellisense works only in the current directory

Describe the bug
Unclear whether inshellisense works only in the current directory

To Reproduce

alex@smartalex-lap:~$ cd Repositories/
alex@smartalex-lap:~/Repositories$ ls
chronos  godbolt-reaper  linked_list_py  porcu-regex  recursivedescent  tmp  ttt  vivify  wrath
alex@smartalex-lap:~/Repositories$ is --shell bash
> cd wrath/
> ls
chronos  godbolt-reaper  linked_list_py  porcu-regex  recursivedescent	tmp  ttt  vivify  wrath
> pwd
/home/alex/Repositories

Expected behavior
By running the commands above you should end up in /home/alex/Repositories/wrath.

Environment

  • OS: XUbuntu 22.04.1
  • Output of inshellisense --version: 0.0.1-rc.1
  • Nodejs Version: v20.6.1

Will i18n supported?

Is your feature request related to a problem? Please describe.
The explanation of autocomplete is not support i18n now.

Describe the solution you'd like
Supports i18n, good for people who use English as a second language.

Describe alternatives you've considered
I still use Google Translate when I'm confused about the explanation of a command.

Additional context
Expect like this: (I'm using Simplified Chinese language package)
image

Tasks

No tasks being tracked yet.

Fail to load zsh binding config: "parse error near `__inshellisense'"

Describe the bug
key-bindings.zsh fail to run when starting a new zsh session.

To Reproduce
Steps to reproduce the behavior:

  1. install via npm
  2. bind to zsh by running inshellisense bind and select zsh
    ~/.inshellisense created
  3. start new terminal session of zsh
  4. error message:

    /Users/chadluo/.inshellisense/key-bindings.zsh:10: parse error near `__inshellisense'

key-bindings.zsh file content:

__inshellisense__() {
    input=$LBUFFER
    LBUFFER=
    inshellisense -c "$input" -s zsh < $TTY
    print -s $(inshellisense --history)
    zle reset-prompt
}

zle     -N   __inshellisense __inshellisense__
bindkey '^A' __inshellisense

Expected behavior
inshellisense loaded and working the same as inshellisense --shell zsh I guess?

Environment

  • OS: macOS 13.6.1 (22G313)
  • Output of inshellisense --version: 0.0.1-rc.1
  • Nodejs Version: v18.17.0
  • Zsh version: zsh 5.9 (x86_64-apple-darwin22.0)

Additional context
inshellisense --shell works fine

Attempts to spawn powershell in Ubuntu bash

Describe the bug
Crashes on fresh install on Ubuntu when using bash.

To Reproduce
Steps to reproduce the behavior:

  1. volta install @microsoft/inshellisense
  2. inshellisense bind
  3. node:internal/errors:496 -> Error: spawn powershell ENOENT

Expected behavior
I assume it should call the bash version?

Environment

  • OS:Ubuntu 22.04
  • Output of inshellisense --version: n/a
  • Nodejs Version: v18.18.1

Additional context
image

Powershell: Can't get the correct profile path

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.

pagedSuggestions.at is not a function on WSL2, node14

Straight after install with node v14.21.3
crash

➜  Code inshellisense --shell zsh

  ERROR  pagedSuggestions.at is not a function

 file:///home/ilovejs/.nvm/versions/node/v14.21.3/lib/node_modules/@microsoft/inshellisense/build/ui/suggestions.js:48:
 48

 -Suggestion (file:///home/ilovejs/.nvm/versions/node/v14.21.3/lib/node_modules/@microsoft/inshellisense/build/ui/sugge
            stions.js:48:48)
 -renderWithHoo (/home/ilovejs/.nvm/versions/node/v14.21.3/lib/node_modules/@microsoft/inshellisense/node_modules/react
  s            -reconciler/cjs/react-reconciler.development.js:7478:18)
 -mountIndeterminateComp (/home/ilovejs/.nvm/versions/node/v14.21.3/lib/node_modules/@microsoft/inshellisense/node_modu
  nent                  les/react-reconciler/cjs/react-reconciler.development.js:11247:13)
 -beginWork (/home/ilovejs/.nvm/versions/node/v14.21.3/lib/node_modules/@microsoft/inshellisense/node_modules/react-rec
           onciler/cjs/react-reconciler.development.js:12760:16)
 -beginWork$ (/home/ilovejs/.nvm/versions/node/v14.21.3/lib/node_modules/@microsoft/inshellisense/node_modules/react-re
            conciler/cjs/react-reconciler.development.js:19569:14)
 -performUnitOfWo (/home/ilovejs/.nvm/versions/node/v14.21.3/lib/node_modules/@microsoft/inshellisense/node_modules/rea
  k              ct-reconciler/cjs/react-reconciler.development.js:18703:12)
 -workLoopSyn (/home/ilovejs/.nvm/versions/node/v14.21.3/lib/node_modules/@microsoft/inshellisense/node_modules/react-r
             econciler/cjs/react-reconciler.development.js:18609:5)
 -renderRootSyn (/home/ilovejs/.nvm/versions/node/v14.21.3/lib/node_modules/@microsoft/inshellisense/node_modules/react
               -reconciler/cjs/react-reconciler.development.js:18577:7)
 -performSyncWorkOnR (/home/ilovejs/.nvm/versions/node/v14.21.3/lib/node_modules/@microsoft/inshellisense/node_modules/
  ot                react-reconciler/cjs/react-reconciler.development.js:18193:20)
 -flushSyncCallbac (/home/ilovejs/.nvm/versions/node/v14.21.3/lib/node_modules/@microsoft/inshellisense/node_modules/re
  s               act-reconciler/cjs/react-reconciler.development.js:2936:22)

The above error occurred in the <Suggestions> component:

    at Suggestions (file:///home/ilovejs/.nvm/versions/node/v14.21.3/lib/node_modules/@microsoft/inshellisense/build/ui/suggestions.js:42:39)
    at ink-box
    at Box (file:///home/ilovejs/.nvm/versions/node/v14.21.3/lib/node_modules/@microsoft/inshellisense/node_modules/ink/build/components/Box.js:5:27)
    at UI (file:///home/ilovejs/.nvm/versions/node/v14.21.3/lib/node_modules/@microsoft/inshellisense/build/ui/ui-root.js:11:15)
    at InternalApp (file:///home/ilovejs/.nvm/versions/node/v14.21.3/lib/node_modules/@microsoft/inshellisense/node_modules/ink/build/components/App.js:19:9)

React will try to recreate this component tree from scratch using the error boundary you provided, InternalApp.
➜  Code node -v
v14.21.3

To Reproduce
install
run like above

Expected behavior
A clear and concise description of what you expected to happen.

Environment

  • OS: win11+inside WSL2
  • Output of inshellisense --version: 0.0.1-rc.1
  • Nodejs Version: v14.21.3

Additional context
Add any other context about the problem here.

Nushell support

Is your feature request related to a problem? Please describe.
no

Describe the solution you'd like
adding support to nushell

Describe alternatives you've considered
not adding support

Additional context

Typing "ls -" does not jump you to the options for the ls command

Describe the bug
Typing ls - does not jump you to the options for the ls command, I have to scroll past potentionally dozens of filenames (depending on the contents of the directory) to get to the parameters for the ls command.

To Reproduce
Steps to reproduce the behavior:

  1. Type ls
  2. Notice the filenames in the current dir are suggested, but not the options like -h etc.
  3. Type -
  4. I still am stuck on viewing filenames, and the options like -h etc. are not visible, I have to scroll down pages to get to them.

Expected behavior
Hitting - should jump you to the options of the ls command, just like find - does and many other commands.

Environment

  • OS: macox
  • Output of inshellisense --version: 0.0.1-rc.4
  • Nodejs Version: v18.16.0

Additional context
Perhaps hitting up arrow to backwards scroll (or some other key) would bypass filenames and get to the options of a command. Getting to the options of a command is, after all, the main point of inshellisense, so making it easy to get to the options is essential.

Parse error near `__inshellisense

Describe the bug
The app fails with .inshellisense/key-bindings.zsh:10: parse error near `__inshellisense' when I open terminal after the installation.

To Reproduce
Steps to reproduce the behavior:

  1. Install the app on Mac M2 Pro
  2. Open new terminal
  3. Get the message.
  4. Inshellisense does not work.

Expected behavior
Everything works fine

Environment

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

Additional context

is -s zsh

  ERROR  pagedSuggestions.at is not a function

 file:///opt/homebrew/lib/node_modules/@microsoft/inshellisense/build/ui/sugges
 tions.js:48:48

 -Suggestion (file:///opt/homebrew/lib/node_modules/@microsoft/inshellisense/bu
            ild/ui/suggestions.js:48:48)
 -renderWithHo (/opt/homebrew/lib/node_modules/@microsoft/inshellisense/node_mo
  ks          dules/react-reconciler/cjs/react-reconciler.development.js:7478:1
              8)
 -mountIndeterminateCo (/opt/homebrew/lib/node_modules/@microsoft/inshellisense
  ponent              /node_modules/react-reconciler/cjs/react-reconciler.devel
                      opment.js:11247:13)
 -beginWor (/opt/homebrew/lib/node_modules/@microsoft/inshellisense/node_module
          s/react-reconciler/cjs/react-reconciler.development.js:12760:16)
 -beginWork$ (/opt/homebrew/lib/node_modules/@microsoft/inshellisense/node_modu
            les/react-reconciler/cjs/react-reconciler.development.js:19569:14)

 -performUnitOfW (/opt/homebrew/lib/node_modules/@microsoft/inshellisense/node_
  rk            modules/react-reconciler/cjs/react-reconciler.development.js:18
                703:12)
 -workLoopSy (/opt/homebrew/lib/node_modules/@microsoft/inshellisense/node_modu
  c         les/react-reconciler/cjs/react-reconciler.development.js:18609:5)
 -renderRootSy (/opt/homebrew/lib/node_modules/@microsoft/inshellisense/node_mo
  c           dules/react-reconciler/cjs/react-reconciler.development.js:18577:
              7)
 -performSyncWorkO (/opt/homebrew/lib/node_modules/@microsoft/inshellisense/nod
  Root            e_modules/react-reconciler/cjs/react-reconciler.development.j
                  s:18193:20)
 -flushSyncCallb (/opt/homebrew/lib/node_modules/@microsoft/inshellisense/node_
  cks           modules/react-reconciler/cjs/react-reconciler.development.js:29
                36:22)

  ERROR  pagedSuggestions.at is not a function

 file:///opt/homebrew/lib/node_modules/@microsoft/inshellisense/build/ui/sugges
 tions.js:48:48

 -Suggestion (file:///opt/homebrew/lib/node_modules/@microsoft/inshellisense/bu
            ild/ui/suggestions.js:48:48)
 -renderWithHo (/opt/homebrew/lib/node_modules/@microsoft/inshellisense/node_mo
  ks          dules/react-reconciler/cjs/react-reconciler.development.js:7478:1
              8)
 -mountIndeterminateCo (/opt/homebrew/lib/node_modules/@microsoft/inshellisense
  ponent              /node_modules/react-reconciler/cjs/react-reconciler.devel
                      opment.js:11247:13)
 -beginWor (/opt/homebrew/lib/node_modules/@microsoft/inshellisense/node_module
          s/react-reconciler/cjs/react-reconciler.development.js:12760:16)
 -beginWork$ (/opt/homebrew/lib/node_modules/@microsoft/inshellisense/node_modu
            les/react-reconciler/cjs/react-reconciler.development.js:19569:14)

 -performUnitOfW (/opt/homebrew/lib/node_modules/@microsoft/inshellisense/node_
  rk            modules/react-reconciler/cjs/react-reconciler.development.js:18
                703:12)
 -workLoopSy (/opt/homebrew/lib/node_modules/@microsoft/inshellisense/node_modu
  c         les/react-reconciler/cjs/react-reconciler.development.js:18609:5)
 -renderRootSy (/opt/homebrew/lib/node_modules/@microsoft/inshellisense/node_mo
  c           dules/react-reconciler/cjs/react-reconciler.development.js:18577:
              7)
 -performSyncWorkO (/opt/homebrew/lib/node_modules/@microsoft/inshellisense/nod
  Root            e_modules/react-reconciler/cjs/react-reconciler.development.j
                  s:18193:20)
 -flushSyncCallb (/opt/homebrew/lib/node_modules/@microsoft/inshellisense/node_
  cks           modules/react-reconciler/cjs/react-reconciler.development.js:29
                36:22)
The above error occurred in the <Suggestions> component:

    at Suggestions (file:///opt/homebrew/lib/node_modules/@microsoft/inshellisense/build/ui/suggestions.js:42:39)
    at ink-box
    at file:///opt/homebrew/lib/node_modules/@microsoft/inshellisense/node_modules/ink/build/components/Box.js:5:27
    at UI (file:///opt/homebrew/lib/node_modules/@microsoft/inshellisense/build/ui/ui-root.js:11:15)
    at App (file:///opt/homebrew/lib/node_modules/@microsoft/inshellisense/node_modules/ink/build/components/App.js:19:9)

React will try to recreate this component tree from scratch using the error boundary you provided, InternalApp.

slow response times

Describe the bug
The cli is quite slow at responding to commands because of #29 and only on windows

To Reproduce
Run is --help, it's slow

Expected behavior
It should be running much faster.

`inshellisense bind` generates windows line endings on linux

Describe the bug

When installing bindings for zsh (other shells haven't been tested) the file ~/.inshellisense/key-bindings.zsh is generated with windows line endings (\r\n) causing parse errors when loading: /home/<username>/.inshellisense/key-bindings.zsh:10: parse error near '__inshellisense'

Workaround
Run dos2unix ~/.inshellisense/key-bindings.zsh

To Reproduce
Steps to reproduce the behavior:

  1. Install inshellisense on Linux
  2. Run inshellisense bind and select zsh
  3. Relaunch/reload shell (source ~/.zshrc)
  4. note parse error

Expected behavior
Inshellisense should generate line endings appropriate to the OS

Environment

  • OS: Ubuntu 22.04
  • Output of inshellisense --version: 0.0.1-rc.1
  • Nodejs Version: v20.9.0

Additional context
Running oh my zsh, but problem appears to continue with bare zsh as well. Original key-bindings.zsh file and updated dos2unix key-bindings.zsh files are attached (file extension changed to .txt to allow upload)

dos2-unix-key-bindings.zsh.txt
original-key-bindings.zsh.txt

backend

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Unsupported shell: '', supported shells: bash, powershell, pwsh, zsh, fish

Describe the bug
After installing, I meet this When I do this:
image

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Environment

  • OS: Win11
  • Output of inshellisense --version: 0.0.1-rc.3
  • Nodejs Version: [e.g. 20.9.0] v20.8.0

Additional context
Add any other context about the problem here.

ctrl a a strange choice for bind - breaks ability to move cursor to beginning of the line

Is your feature request related to a problem? Please describe.
I want to retain the ability to use the normal ctrl-a and ctrl-e features of zsh and bash etc. which move the cursor the beginning and end of the line respectively. By binding to ctrl-a by default, I can no longer move the cursor the the beginning of the line when not using inshellisense.

Describe the solution you'd like
Bind to a key which is not used by zsh and bash etc. Or make it configurable.

Describe alternatives you've considered
The file ~/.inshellisense/key-bindings.zsh contains

bindkey '^A' __inshellisense

so I edited this file and changed the A to O which fixed the problem, but then I lose whatever ^O used to do. Perhaps a CTRL plus SHIFT key combination would be better - how do I specify SHIFT in bindkey?

Additional context
The ability to move to the beginning of the line and end of the line etc. are all broken inside inshellisense anyway, but I guess that's another issue....

Uninstall command/instructions?

Would like a command to uninstall or instructions.

Afaik can uninstall via npm uninstall -g @microsoft/inshellisense, rm -rf ~/.inshellisense and removing the source of binding from ~/.zshrc (or whatever appropriate config file for choosen shell)

Request for support oh-my-zsh

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
I'm using oh-my-zsh on zsh and try to execute is -s zsh. But the terminal will changed to the zsh shell, not my oh-my-zsh shell appearance. I want to use my oh-my-zsh settings while enjoy inshellisense services.

Describe the solution you'd like
A clear and concise description of what you want to happen.
None

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
None

Additional context
Add any other context or screenshots about the feature request here.

Testissue

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Environment

  • OS: [e.g. iOS]
  • Output of inshellisense --version:
  • Nodejs Version: [e.g. 20.9.0]

Additional context
Add any other context about the problem here.

MacOS: binding installed with CRLF

Describe the bug
Binding are installed with CRLF line endings instead of LF on MacOS. As a result zsh fails to load the binding.

To Reproduce
Steps to reproduce the behavior:

  1. inshellisense bind
  2. Select bash
  3. Run:
$ od -c ~/.inshellisense/key-bindings.bash
0000000    _   _   i   n   s   h   e   l   l   i   s   e   n   s   e   _
0000020    _   (   )       {  \r  \n                   i   n   s   h   e
0000040    l   l   i   s   e   n   s   e       -   c       "   $   R   E
0000060    A   D   L   I   N   E   _   L   I   N   E   "       -   s    
0000100    b   a   s   h  \r  \n                   h   i   s   t   o   r
0000120    y       -   s       $   (   i   n   s   h   e   l   l   i   s
0000140    e   n   s   e       -   -   h   i   s   t   o   r   y   )  \r
0000160   \n                   R   E   A   D   L   I   N   E   _   L   I
0000200    N   E   =  \r  \n   }  \r  \n  \r  \n   b   i   n   d       -
0000220    x       '   "   \   C   -   a   "   :       _   _   i   n   s
0000240    h   e   l   l   i   s   e   n   s   e   _   _   '            
0000255

Same problem with zsh.

Expected behavior
The installed shell config should use LF instead of CRLF.

Environment

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.