Comments (9)
@ThePrimeagen
Can confirm,
It works!
from vim-be-good.
The lines
event was one of the most difficult things about learning to work on this project.
I had a lot of trouble getting printouts to work myself. I ended up debugging by running nvim like this: NVIM_NODE_LOG_FILE=nvim.log nvim
and then using console.log
which will show up in that log file. Can you try that and put log statements in onLineEvent
, then check if they show up in the log file?
I would place console.log('in line event handler ' + JSON.stringify(args))
as the first line of onLineEvent
.
I also noticed that the round number is showing up for you, but it doesn't for me. That is interesting!
Let me know how it goes.
from vim-be-good.
Thanks for getting back to me. The log file was exactly what I was looking for!
I attached the log to listenLines
:
this.listenLines = (args: any[]) => {
console.log('in line event handler ' + JSON.stringify(args))
if (this.linesCallback) {
this.linesCallback(args);
}
}
Full log output:
{"message":"host.start","level":"debug"}
{"level":"info","message":"handleRequest: "}
{"level":"debug","message":"request received: "}
{"level":"info","message":"handleRequest: "}
{"level":"debug","message":"request received: "}
{"message":"requested specs for /home/liam/.vim/bundle/vim-be-good/rplugin/node/vim-be-good","level":"debug"}
{"message":"createPlugin./home/liam/.vim/bundle/vim-be-good/rplugin/node/vim-be-good.clearCache: true","level":"debug"}
{"level":"debug","message":"getPlugin.alwaysInit"}
{"message":"[{\"type\":\"command\",\"name\":\"VimBeGood2\",\"sync\":false,\"opts\":{\"nargs\":\"*\"}}]","level":"debug"}
{"message":"specs: [\n {\n type: 'command',\n name: 'VimBeGood2',\n sync: false,\n opts: { nargs: '*' }\n }\n]","level":"debug"}
{"message":"host.start","level":"debug"}
{"level":"info","message":"handleRequest: "}
{"level":"debug","message":"request received: "}
{"level":"info","message":"handleRequest: "}
{"level":"debug","message":"request received: "}
{"message":"requested specs for /home/liam/.vim/bundle/vim-be-good/rplugin/node/vim-be-good","level":"debug"}
{"message":"createPlugin./home/liam/.vim/bundle/vim-be-good/rplugin/node/vim-be-good.clearCache: true","level":"debug"}
{"level":"debug","message":"getPlugin.alwaysInit"}
{"message":"[{\"type\":\"command\",\"name\":\"VimBeGood2\",\"sync\":false,\"opts\":{\"nargs\":\"*\"}}]","level":"debug"}
{"message":"specs: [\n {\n type: 'command',\n name: 'VimBeGood2',\n sync: false,\n opts: { nargs: '*' }\n }\n]","level":"debug"}
{"message":"host.start","level":"debug"}
{"level":"info","message":"handleRequest: "}
{"level":"debug","message":"request received: "}
{"level":"info","message":"handleRequest: "}
{"level":"debug","message":"request received: "}
{"message":"requested specs for /home/liam/.vim/bundle/vim-be-good/rplugin/node/vim-be-good","level":"debug"}
{"message":"createPlugin./home/liam/.vim/bundle/vim-be-good/rplugin/node/vim-be-good.clearCache: true","level":"debug"}
{"level":"debug","message":"getPlugin.alwaysInit"}
{"message":"[{\"type\":\"command\",\"name\":\"VimBeGood2\",\"sync\":false,\"opts\":{\"nargs\":\"*\"}}]","level":"debug"}
{"message":"specs: [\n {\n type: 'command',\n name: 'VimBeGood2',\n sync: false,\n opts: { nargs: '*' }\n }\n]","level":"debug"}
{"message":"host.start","level":"debug"}
{"level":"info","message":"handleRequest: "}
{"level":"debug","message":"request received: "}
{"level":"info","message":"handleNotification: "}
{"level":"debug","message":"host.handlePlugin: "}
{"message":"createPlugin./mnt/c/Users/Liam/Documents/projects/vim-be-good-bug-fix/rplugin/node/vim-be-good.clearCache: true","level":"debug"}
{"level":"debug","message":"getPlugin.alwaysInit"}
{"message":"request -> neovim.api.nvim_get_current_buf","level":"debug"}
{"message":"response -> neovim.api.nvim_get_current_buf: [object Object]","level":"debug"}
{"message":"request -> neovim.api.nvim_buf_line_count","level":"debug"}
{"message":"response -> neovim.api.nvim_buf_line_count: 1","level":"debug"}
{"message":"request -> neovim.api.nvim_buf_get_lines","level":"debug"}
{"message":"response -> neovim.api.nvim_buf_get_lines: ","level":"debug"}
{"message":"request -> neovim.api.nvim_get_current_buf","level":"debug"}
{"message":"response -> neovim.api.nvim_get_current_buf: [object Object]","level":"debug"}
{"message":"request -> neovim.api.nvim_get_current_win","level":"debug"}
{"message":"response -> neovim.api.nvim_get_current_win: [object Object]","level":"debug"}
{"message":"[vim-be-good] Game init","level":"info"}
{"message":"request -> neovim.api.nvim_buf_attach","level":"debug"}
{"message":"request -> neovim.api.nvim_buf_set_lines","level":"debug"}
{"message":"response -> neovim.api.nvim_buf_attach: null","level":"debug"}
{"level":"error","message":"Error making request to nvim_buf_attachnvim_buf_attach: Invalid method name","stack":"Error: Error making request to nvim_buf_attach\n at Buffer.request (/usr/local/lib/node_modules/neovim/lib/api/Base.js:75:23)\n at Buffer.<anonymous> (/usr/local/lib/node_modules/neovim/lib/api/Buffer.js:31:25)\n at Generator.next (<anonymous>)\n at /usr/local/lib/node_modules/neovim/lib/api/Buffer.js:8:71\n at new Promise (<anonymous>)\n at __awaiter (/usr/local/lib/node_modules/neovim/lib/api/Buffer.js:4:12)\n at Buffer.<computed> (/usr/local/lib/node_modules/neovim/lib/api/Buffer.js:28:58)\n at Buffer.listen (/usr/local/lib/node_modules/neovim/lib/api/Buffer.js:298:33)\n at new BaseGame (/mnt/c/Users/Liam/Documents/projects/vim-be-good-bug-fix/rplugin/node/vim-be-good/game/base.js:103:27)\n at new DeleteGame (/mnt/c/Users/Liam/Documents/projects/vim-be-good-bug-fix/rplugin/node/vim-be-good/game/delete.js:16:9)"}
{"level":"info","message":"Unhandled Rejection at:"}
{"message":"response -> neovim.api.nvim_buf_set_lines: null","level":"debug"}
{"message":"request -> neovim.api.nvim_buf_set_lines","level":"debug"}
{"message":"response -> neovim.api.nvim_buf_set_lines: null","level":"debug"}
{"message":"request -> neovim.api.nvim_buf_set_lines","level":"debug"}
{"message":"response -> neovim.api.nvim_buf_set_lines: null","level":"debug"}
{"message":"request -> neovim.api.nvim_buf_set_lines","level":"debug"}
{"message":"response -> neovim.api.nvim_buf_set_lines: null","level":"debug"}
{"message":"request -> neovim.api.nvim_buf_line_count","level":"debug"}
{"message":"response -> neovim.api.nvim_buf_line_count: 1","level":"debug"}
{"message":"request -> neovim.api.nvim_buf_set_lines","level":"debug"}
{"message":"response -> neovim.api.nvim_buf_set_lines: null","level":"debug"}
{"message":"request -> neovim.api.nvim_buf_set_lines","level":"debug"}
{"message":"response -> neovim.api.nvim_buf_set_lines: null","level":"debug"}
{"message":"request -> neovim.api.nvim_command","level":"debug"}
{"message":"response -> neovim.api.nvim_command: null","level":"debug"}
{"message":"request -> neovim.api.nvim_buf_line_count","level":"debug"}
{"message":"response -> neovim.api.nvim_buf_line_count: 25","level":"debug"}
{"message":"request -> neovim.api.nvim_buf_set_lines","level":"debug"}
{"message":"response -> neovim.api.nvim_buf_set_lines: null","level":"debug"}
{"message":"request -> neovim.api.nvim_buf_set_lines","level":"debug"}
{"message":"response -> neovim.api.nvim_buf_set_lines: null","level":"debug"}
I also added a log in the game constructor just make sure that logs were being outputted correctly:
{"message":"[vim-be-good] Game init","level":"info"}
I played the game until the point where the game gets stuck. The log does not show the desired output but does raise the following error:
{"level":"error","message":"Error making request to nvim_buf_attachnvim_buf_attach: Invalid method name","stack":"Error: Error making request to nvim_buf_attach\n at Buffer.request (/usr/local/lib/node_modules/neovim/lib/api/Base.js:75:23)\n at Buffer.<anonymous> (/usr/local/lib/node_modules/neovim/lib/api/Buffer.js:31:25)\n at Generator.next (<anonymous>)\n at /usr/local/lib/node_modules/neovim/lib/api/Buffer.js:8:71\n at new Promise (<anonymous>)\n at __awaiter (/usr/local/lib/node_modules/neovim/lib/api/Buffer.js:4:12)\n at Buffer.<computed> (/usr/local/lib/node_modules/neovim/lib/api/Buffer.js:28:58)\n at Buffer.listen (/usr/local/lib/node_modules/neovim/lib/api/Buffer.js:298:33)\n at new BaseGame (/mnt/c/Users/Liam/Documents/projects/vim-be-good-bug-fix/rplugin/node/vim-be-good/game/base.js:103:27)\n at new DeleteGame (/mnt/c/Users/Liam/Documents/projects/vim-be-good-bug-fix/rplugin/node/vim-be-good/game/delete.js:16:9)"}
{"level":"info","message":"Unhandled Rejection at:"}
I had a very quick look into this error and found that it could be related to my version of neovim:
:version
NVIM v0.2.2
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -g -O2 -fdebug-prefix-map=/build/neovim-_mzR4z/neovim-0.2.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -DDISABLE_LOG -Wdate-time -D_FORTIFY_SOURCE=2 -Wconve
rsion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -O2 -g -DMIN_LOG_LEVEL=3 -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -
Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/build/neovim-_mzR4z/neovim-0.2.2/build/config -I/build/neovim-_mzR4z/neovim-0.2.2/src -I/usr/include -I/usr/include -I/usr/in
clude -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/build/neovim-_mzR4z/neovim-0.2.2/build/src/nvim/auto -I/build/neovim-_mzR4z/neovim-0.2.2/build/include
Compiled by [email protected]
Features: +acl +iconv +jemalloc +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"
It seems v0.2.2
is very far behind the latest release. I will update my version and try again later and get back to you.
from vim-be-good.
from vim-be-good.
@Liamdoult did brandoncc's fix ever work?
from vim-be-good.
Apologies for not following up.
@ThePrimeagen I am not sure...
I updated my neovim version (v0.2.2
-> v0.4.3
). But before the lines
listener is invoked, the game freezes. From what I can tell this is caused by the this.state.buffer.setLines
never actually changing the state of the lines. The await
is resolved but the content displayed on my screen never changes.
I am not sure why I am having so many issues (perhaps its a calling from ubuntu/i3 to my inferior windows/WSL setup), and have not had any time look into it, unfortunately.
I am happy to collect any information you think would be relevant to the conversation. However, I am not sure this is an issue caused by this project, and rather some interface issues with neovim (and my setup)... I personally would not have a problem with closing this issue, until we know that other people are experiencing the same issue.
It will just be a shame that I do not get to wack any moles or jump any lines. But life goes on... 😂
from vim-be-good.
No, please keep the issue open.
Tonight I am going to be doing some "refuctoring" on this project and I hope to get it into a better state. I'll be adding a lot of additional logging such that when these types of issues arise I can better debug it
from vim-be-good.
There should be significantly more logging now. would you mind rerunnning the previous example? You will need to get the latest and follow the install instructions. THEY HAVE CHANGED just so you know :)
from vim-be-good.
awesome @Liamdoult !!
from vim-be-good.
Related Issues (20)
- configurable window size
- Bug: neovim instance does not resize itself automatically HOT 1
- New game: twoSimpleStes
- Cracking Game by macro ^_^
- Change default colors/ allow setting custom colors.
- oops
- Failed to initialize lua interpreter/root HOT 1
- All words can be equal in game type 'words' HOT 1
- Docker image doesn't work on M1 HOT 2
- E492: Not an editor command: VimBeGood HOT 8
- Unable to install using packer HOT 2
- docker?
- Wrong neovim vesion on README.md HOT 1
- Give more hints please HOT 3
- VSCode emulation using ncurses
- make a website out of this HOT 3
- Some error in ci{ game HOT 2
- when playing relative game mode on small screen ( 1366x768 ), DELETE_ME thing spawns beyond detectable lines
- lazy-nvim equivalent installation HOT 2
- Create Docker image HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-be-good.