onivim / oni

Oni: Modern Modal Editing - powered by Neovim
https://www.onivim.io
MIT License
11.35k stars 299 forks source link

QuickInfo doesn't appear until file is modified #122

Closed keforbes closed 7 years ago

keforbes commented 7 years ago

There's probably a better way to describe this but I've noticed when I first open Oni, the QuickInfo doesn't appear at all. Yet if I make some modification to the file, QuickInfo suddenly starts working. Just entering insert mode isn't enough, I actually have to make a change.

In my example below, QuickInfo doesn't work. I then hit o to open a new line, exit insert mode, and suddenly QuickInfo is working. quickinfo_init

bryphe commented 7 years ago

Interesting... It looks like somehow the typescript plugin isn't being fully initialized until a change is being made. It also seems like the syntax highlighting from the plugin isn't working.

Do you know what version of typescript is installed? You can check in node_modules/typescript/package.json. It might be worth bumping that to the latest, just to rule out a typescript version issue.

You can also debug the typescript plugin by changing the debugging: false line (line 13) in vim\core\oni-plugin-typescript\package.json to debugging: true. With that change, when the plugin initializes, it'll pop open a debugger window. I wonder if there is a script error or something there.

Unfortunately, I'm not able to reproduce this on my build (on either Win10 or Linux) - which OS are you on?

keforbes commented 7 years ago

This is on Linux. I'm using typescript 2.1.4. Setting debugging: true didn't help. I've been looking at the console output and I don't see anything special. No change in console output before and after modifying the file either.

bryphe commented 7 years ago

I think I am seeing something similiar now - I don't get any highlighting, etc, until I move around the file. Need to investigate the plugin lifecycle and see if it was waiting for a specific event from Vim before it kicks off the integration.

keforbes commented 7 years ago

Update for this defect, even though no one else seems to be seeing it...

In PluginManager.ts, line 172 says:

if (!pluginResponse.error) {

If there is no error, display QuickInfo. If there is an error, hide the QuickInfo (no-op). It seems prior to editing the file, pluginResponse.error exists. Unfortunately, it's an empty object {} so it doesn't really help me with troubleshooting. Also, pluginResponse doesn't have a payload object so there'd be nothing to display even if I wanted to. After editing the file, pluginResponse does not have an error object at all and it has a payload object with the contents of the QuickInfo.

keforbes commented 7 years ago

Here are the raw events by the way. Empty error object: cross-browser-ipc: {"error":{},"meta":{"destinationId":1,"originEvent":{"bufferFullPath":"/home/kforbes/Documents/oni/main.js","bufferNumber":1,"bufferTotalLines":169,"byte":208,"column":1,"filetype":"javascript","line":6,"version":3,"wincol":5,"windowBottomLine":33,"windowNumber":1,"windowTopLine":1,"winline":6},"senderId":5},"type":"show-quick-info"}

Payload defined: cross-browser-ipc: {"meta":{"destinationId":1,"originEvent":{"bufferFullPath":"/home/kforbes/Documents/oni/main.js","bufferNumber":1,"bufferTotalLines":170,"byte":214,"column":7,"filetype":"javascript","line":6,"version":4,"wincol":11,"windowBottomLine":33,"windowNumber":1,"windowTopLine":1,"winline":6},"senderId":5},"payload":{"documentation":"","info":"const os: typeof \"os\""},"type":"show-quick-info"}

bryphe commented 7 years ago

Thanks for the update, @keforbes ! I actually do see this too. It looks like I don't need to modify the file - just moving around gets the quick info / highlighting to kick in. I believe the reason I was not seeing this was because I was habitually pressing j when opening a file :) This on my list to look at - the info you gave is helpful.

keforbes commented 7 years ago

Another update. I just tried this again and now there's only a minor difference in behavior. If I open a file with Fuzzy Finder or File -> Open, everything works fine. If I open a file by providing the filename on the command-line, the QuickInfo works fine but the imported packages don't get syntax highlighted. I can't find any feature that isn't working, it's just that if I open a file with Fuzzy Finder the imports turn blue yet if I provide a filename on the command-line the imports stay the normal text color.

oni browser/src/NeovimInstance.ts without oni <Ctrl-P> NeovimInstance.ts with As far as I can tell, this is now just a minor visual oddity. I'll close this issue and if I find a difference in behavior I'll file a new issue.