Skip to content

Commit

Permalink
feat(findNvim): version parsing robustness
Browse files Browse the repository at this point in the history
Problem:
Version parsing makes some assumptions about the `nvim -v` output that
could be more robust. For example,
- "NVIM" may change to "Nvim": neovim/neovim@98ba65b
- "v" is not guaranteed to precede the version

Solution:
- match case-insensitive "NVIM"
- match "v?" instead of "v"
- Note: `--api-info` is not used because it is a big payload (thus
  requires streamed decoding, thus more complex code).
  • Loading branch information
justinmk committed Oct 15, 2024
1 parent ba4c247 commit 0b2008a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## [5.4.0](https://github.com/neovim/node-client/compare/v5.3.0...v5.4.0)

- TODO
- feat(findNvim): version parsing robustness

## [5.3.0](https://github.com/neovim/node-client/compare/v5.2.1...v5.3.0)

Expand Down
2 changes: 1 addition & 1 deletion packages/neovim/src/utils/findNvim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export type FindNvimResult = {
};

const versionRegex = /^(\d+)\.(\d+)\.(\d+)(?:-(.+))?$/;
const nvimVersionRegex = /^NVIM\s+v(.+)$/m;
const nvimVersionRegex = /^[nN][vV][iI][mM]\s+v?(.+)$/m;
const buildTypeRegex = /^Build\s+type:\s+(.+)$/m;
const luaJitVersionRegex = /^LuaJIT\s+(.+)$/m;
const windows = process.platform === 'win32';
Expand Down

0 comments on commit 0b2008a

Please sign in to comment.