microsoft / inshellisense

IDE style command line auto complete
MIT License
8.21k stars 179 forks source link

TypeError: Cannot read properties of undefined (reading 'line') at CommandManager.termSync #205

Closed whiskeyo closed 3 months ago

whiskeyo commented 3 months ago

Describe the bug Trying to open some file in vim from different directory than the "initial", from which inshellisense has been run, generates TypeError and inshellisense crashes. The log is below:

file:///home/whiskeyo/inshellisense/build/isterm/commandManager.js:195
            for (let i = globalCursorPosition; i < this.#activeCommand.promptEndMarker.line + maxPromptPollDistance; i++) {
                                                                                       ^

TypeError: Cannot read properties of undefined (reading 'line')
    at CommandManager.termSync (file:///home/whiskeyo/inshellisense/build/isterm/commandManager.js:195:88)
    at file:///home/whiskeyo/inshellisense/build/isterm/pty.js:54:38
    at n._innerWrite (/home/whiskeyo/inshellisense/node_modules/xterm-headless/lib-headless/xterm-headless.js:1:93524)
    at Timeout._onTimeout (/home/whiskeyo/inshellisense/node_modules/xterm-headless/lib-headless/xterm-headless.js:1:93035)
    at listOnTimeout (node:internal/timers:569:17)
    at process.processTimers (node:internal/timers:512:7)

To Reproduce Steps to reproduce the behavior:

  1. Go to home directory (or any other), create directory example (optional: and inside create a file something.txt)
  2. Run inshellisense inside the home directory
  3. Change directory to example
  4. Try to run vim something.txt
  5. Error from the description appears and inshellisense crashes (is -c returns "session not found")

Feel free to use these commands to reproduce it quicker:

cd ~ && mkdir example && touch example/somefile.txt
is -s bash
cd example
vim somefile.txt
# when I used: cd example && vim somefile.txt it did not show an error, this is strange :)

Expected behavior All apps should open normally and inshellisense should not crash

Environment

Additional context If you have some questions, I'll try to answer ASAP. Here you can find a short video with the problem: https://www.youtube.com/watch?v=PSVm_k_zGsw