uesteibar / hyperdocs

(UNSUPPORTED) Get docs right in your hyper terminal.
https://www.npmjs.com/package/hyperdocs
Other
13 stars 7 forks source link

Getting commandNotFound documentation #6

Closed alobaidizt closed 7 years ago

alobaidizt commented 7 years ago

Hi, I have just installed hyperdocs plugin using hpm and ran it inside zsh shell. It triggered the internal browser window with duckduckgo search... but it used commandNotFound documentation as the search text. In another try, it used something like this 0m39sreactK command for the search text. Could you please investigate or point out what's the issue? Appreciate the effort!

uesteibar commented 7 years ago

Hi @alobaidizt!!

I've just tried to reproduce the issue and I wasn't able, could you tell me what did you type into hyper to get this?

Thanks for reporting! 😃

uesteibar commented 7 years ago

Hi again @alobaidizt!

I just shipped version 1.1.2 which fixes some of the issues you had.

After some research, I found out that sometimes I don't get the command properly in the reducer, mainly when typing very fast right when opening hyper. Due to this, sometimes the command (which should be react in this case) is undefined and it won't find the docs. This will still happen, but I changed the decision making of when to and when not to open the window to be based on this instead, so at least the window won't pop up with the wrong data (or empty).

For the case of 0m39sreactK command seems to be something messing up with your prompt (mine was causing a similar issue but with different characters), but that's what I get from hyper into my reducer so I can't think of a way to avoid this.

These both look like general issues and the current workaround seems to be shipping a bin file together with the npm package, as hyperchart is doing.

I opened this issue for this and I'll implement it in the future, but I hope for now version 1.1.2 behaves better for you :)

Thanks for using the plugin and for pointing out the problem!

uesteibar commented 7 years ago

@alobaidizt if this is fine for you I'll close the issue as soon as you give your OK.

alobaidizt commented 7 years ago

@uesteibar I just tried adding it again with using the latest version and I still get the weird response. At this point, it's most likely to be caused by my config. I've made a short video to document the issue. I've also shared my .hyper.js file below:

hyperdocs bug

// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.

module.exports = {
  config: {
    // default font size in pixels for all tabs
    fontSize: 12,

    // font family with optional fallbacks
    fontFamily: 'Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',

    // terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
    cursorColor: 'rgba(248,28,229,0.8)',

    // `BEAM` for |, `UNDERLINE` for _, `BLOCK` for â–ˆ
    cursorShape: 'BLOCK',

    // set to true for blinking cursor
    cursorBlink: false,

    // color of the text
    foregroundColor: '#fff',

    // terminal background color
    backgroundColor: '#000',

    // border color (window, tabs)
    borderColor: '#333',

    // custom css to embed in the main window
    css: '',

    // custom css to embed in the terminal window
    termCSS: '',

    // set to `true` (without backticks) if you're using a Linux setup that doesn't show native menus
    // default: `false` on Linux, `true` on Windows (ignored on macOS)
    showHamburgerMenu: '',

    // set to `false` if you want to hide the minimize, maximize and close buttons
    // additionally, set to `'left'` if you want them on the left, like in Ubuntu
    // default: `true` on windows and Linux (ignored on macOS)
    showWindowControls: '',

    // custom padding (css format, i.e.: `top right bottom left`)
    padding: '12px 14px',

    // the full list. if you're going to provide the full color palette,
    // including the 6 x 6 color cubes and the grayscale map, just provide
    // an array here instead of a color map object
    colors: {
      black: '#000000',
      red: '#ff0000',
      green: '#33ff00',
      yellow: '#ffff00',
      blue: '#0066ff',
      magenta: '#cc00ff',
      cyan: '#00ffff',
      white: '#d0d0d0',
      lightBlack: '#808080',
      lightRed: '#ff0000',
      lightGreen: '#33ff00',
      lightYellow: '#ffff00',
      lightBlue: '#0066ff',
      lightMagenta: '#cc00ff',
      lightCyan: '#00ffff',
      lightWhite: '#ffffff'
    },

    // the shell to run when spawning a new session (i.e. /usr/local/bin/fish)
    // if left empty, your system's login shell will be used by default
    // make sure to use a full path if the binary name doesn't work
    // (e.g `C:\\Windows\\System32\\bash.exe` instead of just `bash.exe`)
    // if you're using powershell, make sure to remove the `--login` below
    shell: '/bin/zsh',

    // for setting shell arguments (i.e. for using interactive shellArgs: ['-i'])
    // by default ['--login'] will be used
    shellArgs: ['--login'],

    // for environment variables
    env: {},

    // set to false for no bell
    bell: 'SOUND',

    // if true, selected text will automatically be copied to the clipboard
    copyOnSelect: false

    // if true, on right click selected text will be copied or pasted if no
    // selection is present (true by default on Windows)
    // quickEdit: true

    // URL to custom bell
    // bellSoundURL: 'http://example.com/bell.mp3',

    // for advanced config flags please refer to https://hyper.is/#cfg
  },

  // a list of plugins to fetch and install from npm
  // format: [@org/]project[#version]
  // examples:
  //   `hyperpower`
  //   `@company/project`
  //   `project#1.0.1`
  plugins: [
    'hyperline',
    'hypercwd',
    'hyperterm-focus-reporting',
    'hyper-statusline',
    "hyperpower",
    "hyper-materialshell",
    "hyperdocs"
  ],

  // in development, you can create a directory under
  // `~/.hyper_plugins/local/` and include it here
  // to load it and avoid it being `npm install`ed
  localPlugins: []
};
alobaidizt commented 7 years ago

Appreciate your efforts! I hope the details above help with debugging!

uesteibar commented 7 years ago

@alobaidizt thanks!

I'll have a look into this with your same config as soon as possible :)

uesteibar commented 7 years ago

Hi again @alobaidizt!

I've tried to debug this with your same hyper config, but didn't manage to reproduce. I attached a video:

hyperdocs_issue

My guess would be that it has something to do with your local zsh config, which is a bit more complicated to reproduce.

For the error where the window does not open, it's also happening to me with my own config and should be fixed when implementing https://github.com/uesteibar/hyperdocs/issues/7.

For the error with the weird characters in the duckduckgo search, would you be willing to clone the repo into your ~/.hyper_plugins/local/ folder, and console.log({data}) here? After changing the code, don't forget to npm run build and refresh your browser. There's more information on how to run the plugin locally in the README file.

This way I could mock the input with exactly what you're getting and figure out what's happening.

Let me know about this, and thanks again!

P.D: First bug, and such a tricky one 🙈

alobaidizt commented 7 years ago

Thanks, @uesteibar! I'll dig into it a little more

uesteibar commented 7 years ago

@alobaidizt any update on this, or is it fine if I just close the issue? :)

uesteibar commented 7 years ago

Since there was no feedback for a while, I'll close this. @alobaidizt please reopen with new information if necessary. Thanks!

s5bug commented 7 years ago

@uesteibar Can reproduce. Windows, opened window can not be moved or resized.

Note: I am using a custom $PS1 on Windows Bash.

Screenshot

Hyper config:

// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
  config: {
    // default font size in pixels for all tabs
    fontSize: 12,

    // font family with optional fallbacks
    fontFamily: 'Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',

    // terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
    cursorColor: 'rgba(248,28,229,0.8)',

    // `BEAM` for |, `UNDERLINE` for _, `BLOCK` for â–ˆ
    cursorShape: 'BLOCK',

    // set to true for blinking cursor
    cursorBlink: false,

    // color of the text
    foregroundColor: '#fff',

    // terminal background color
    backgroundColor: '#000',

    // border color (window, tabs)
    borderColor: '#333',

    // custom css to embed in the main window
    css: '',

    // custom css to embed in the terminal window
    termCSS: '',

    // set to `true` (without backticks) if you're using a Linux setup that doesn't show native menus
    // default: `false` on Linux, `true` on Windows (ignored on macOS)
    showHamburgerMenu: '',

    // set to `false` if you want to hide the minimize, maximize and close buttons
    // additionally, set to `'left'` if you want them on the left, like in Ubuntu
    // default: `true` on windows and Linux (ignored on macOS)
    showWindowControls: '',

    // custom padding (css format, i.e.: `top right bottom left`)
    padding: '12px 14px',

    // the full list. if you're going to provide the full color palette,
    // including the 6 x 6 color cubes and the grayscale map, just provide
    // an array here instead of a color map object
    colors: {
      black: '#000000',
      red: '#ff0000',
      green: '#33ff00',
      yellow: '#ffff00',
      blue: '#0066ff',
      magenta: '#cc00ff',
      cyan: '#00ffff',
      white: '#d0d0d0',
      lightBlack: '#808080',
      lightRed: '#ff0000',
      lightGreen: '#33ff00',
      lightYellow: '#ffff00',
      lightBlue: '#0066ff',
      lightMagenta: '#cc00ff',
      lightCyan: '#00ffff',
      lightWhite: '#ffffff'
    },

    // the shell to run when spawning a new session (i.e. /usr/local/bin/fish)
    // if left empty, your system's login shell will be used by default
    // make sure to use a full path if the binary name doesn't work
    // (e.g `C:\\Windows\\System32\\bash.exe` instead of just `bash.exe`)
    // if you're using powershell, make sure to remove the `--login` below
    shell: 'C:\\Windows\\System32\\bash.exe',

    // for setting shell arguments (i.e. for using interactive shellArgs: ['-i'])
    // by default ['--login'] will be used
    shellArgs: ['--login'],

    // for environment variables
    env: {},

    // set to false for no bell
    bell: 'SOUND',

    // if true, selected text will automatically be copied to the clipboard
    copyOnSelect: false,

    modifierKeys: {
        cmdIsMeta: false,
        altIsMeta: true
    },

    // if true, on right click selected text will be copied or pasted if no
    // selection is present (true by default on Windows)
    // quickEdit: true

    // URL to custom bell
    // bellSoundURL: 'http://example.com/bell.mp3',

    // for advanced config flags please refer to https://hyper.is/#cfg

    hyperRun: ['cd', 'eval `./angel-PS1`', 'clear'],
    hyperRunTab: ['cd', 'eval `./angel-PS1`', 'clear'],
  },

  // a list of plugins to fetch and install from npm
  // format: [@org/]project[#version]
  // examples:
  //   `hyperpower`
  //   `@company/project`
  //   `project#1.0.1`
  plugins: [
    'hyperlinks',
    'hyper-run',
    'hyperdocs',
  ],

  // in development, you can create a directory under
  // `~/.hyper_plugins/local/` and include it here
  // to load it and avoid it being `npm install`ed
  localPlugins: []
};
alobaidizt commented 7 years ago

@uesteibar no updates. Decided to move back to iterm2 for the time being. Thanks!

uesteibar commented 7 years ago

hey thanks for the report @TsundereBug!!

I don't have a windows machine to test this out tho, were you on windows too @alobaidizt?

alobaidizt commented 7 years ago

@uesteibar no, I was on Mac

uesteibar commented 7 years ago

I'll try to sort this out and get back to you, thanks!

s5bug commented 7 years ago

Problem might be related to zeit/hyperlinks#7. Plausible that this is an electron bug, but it doesn't seem like it.

uesteibar commented 7 years ago

@TsundereBug not able to reproduce this locally, and I don't have access to a windows machine to try it out there.

I'll close this issue for now since it seems to be a collision with local zsh configuration.

Thanks for the report.