Skip to content

Conversation

@DrKJeff16
Copy link

@DrKJeff16 DrKJeff16 commented Jun 30, 2024

Original PR

NOTE: DON'T MERGE THIS PR YET (if you were ever planning to do so). I partially added some annotations and
took the liberty to make some minimal code corrections myself... well, except for
Telescope.

See Edit 1 for the details.

See Edit 2 for an update.


TOC

  1. TL;DR
  2. Changes List
  3. Edits
    1. [2024-08-12]
    2. [2024-08-12]

TL;DR

This is an attempt to fix #153 - related issues.
My fork will be maintained regularly by for the foreseeable future as this seems unmaintained,
and so I'll attempt to resolve issues and add documentation in particular.

Changes List

  • vim.api.nvim_buf_get_clients ==> vim.api.nvim_get_clients
  • Use vim.api.nvim_get_current_buf() to determine current buffer (a pet-peeve of mine, but will revert to 0 if needed)
  • Use vim.uv over vim.loop if available
  • Added detailed type annotations across modules
  • Made minor fixes to code sections
  • Format with stylua

Any feedback is appreciated c:


Edits

[2024-08-08]

Added some annotations to some files and made some code fixes. Telescope is missing.
It's still a WIP, so I'd really like some feedback from you, but I'll continue
with the changes for now.

If you have any comment, I'll make sure to rollback/fix/extend my contributions with your suggestions in mind.

Sample (lua/project_nvim/config.lua):
---@class Project.Config.Options
---@field manual_mode? boolean
---@field detection_methods? ("lsp"|"pattern")[]
---@field patterns? string[]
---@field ignore_lsp? string[]
---@field exclude_dirs? string[]
---@field show_hidden? boolean
---@field silent_chdir? boolean
---@field datapath? string

---@class Project.Config
---@field defaults Project.Config.Options
---@field options Project.Config.Options
---@field setup fun(options: Project.Config.Options)

---@type Project.Config
---@diagnostic disable-next-line:missing-fields
local M = {
  defaults = {
  --- ...

[2024-08-12]

@ahmedkhalf (Sorry for the ping btw) I have documented the code for good, and done my part for this PR. If you have any feedback please let me know. I'll also gladly keep making PRs for fixes/additions for this plugin if warranted.

I thank you for your attention c:

Signed-off-by: Guennadi Maximov C <[email protected]>
Switched deprecated functions to supported ones, and thus
accomodated code.
Let's not redefine identifiers please. Switch them
to a more suitable name.
`vim.loop` is still supported, but only as a fallback.
- Added annotations for almost every section that warranted it... except
  for Telescope, that's a pending one...
- Fixed some statements assigned in the wrong scope
- Added structured names for all non-telescope modules
- Some TODOS/etc. were added
- Formatting issues

Overall, annotations are working as intended and, as far as I've
been able to test, none of my code fixes break anything.

Signed-off-by: Guennadi Maximov C <[email protected]>
- Fixed some `var == false` `if` statements as they were redundant
- Simplified code logic (e.g. removed unnecessary code blocks)
- Moved variable declaration to correct scope instead of inside a loop

Signed-off-by: Guennadi Maximov C <[email protected]>
- Fixed some `var == false` `if` statements as they were redundant
- Switched dictionary-like call to field call in table statement

Signed-off-by: Guennadi Maximov C <[email protected]>
- Added annotations for almost every section that warranted it... except
  for Telescope, that's a pending one...
- Fixed some statements assigned in the wrong scope
- Added structured names for all non-telescope modules
- Some TODOS/etc. were added
- Formatting issues

Overall, annotations are working as intended and, as far as I've
been able to test, none of my code fixes break anything.

Signed-off-by: Guennadi Maximov C <[email protected]>
- Fixed some `var == false` `if` statements as they were redundant
- Simplified code logic (e.g. removed unnecessary code blocks)
- Moved variable declaration to correct scope instead of inside a loop

Signed-off-by: Guennadi Maximov C <[email protected]>
- Fixed some `var == false` `if` statements as they were redundant
- Switched dictionary-like call to field call in table statement

Signed-off-by: Guennadi Maximov C <[email protected]>
Since indentation is variable across users, make sure to
enforce it when opening Lua files using (Neo)Vim.

Signed-off-by: Guennadi Maximov C <[email protected]>
Since indentation is variable across users, make sure to
enforce it when opening Lua files using (Neo)Vim.

Signed-off-by: Guennadi Maximov C <[email protected]>
@DrKJeff16
Copy link
Author

Well, crap. I messed up the commit history :p, I'll try and fix it later. Looks horrible.

I hate git rebase

DrKJeff16 added 21 commits June 16, 2025 13:38
Signed-off-by: Guennadi Maximov C <[email protected]>
Signed-off-by: Guennadi Maximov C <[email protected]>
Personally I think using `next()` is a general purpose solution, rather
than alternating between `ipairs()` and `pairs()`.

Signed-off-by: Guennadi Maximov C <[email protected]>
* Favour using `string.format()` over string concatenation
* Decreased complexity for certain code blocks
* Renamed identifiers
* Other useless, style stuff

Signed-off-by: Guennadi Maximov C <[email protected]>
Signed-off-by: Guennadi Maximov C <[email protected]>
@DrKJeff16 DrKJeff16 closed this Jun 21, 2025
@DrKJeff16 DrKJeff16 deleted the jeff branch June 21, 2025 05:42
@DrKJeff16 DrKJeff16 changed the title Fixed deprecations, adapted some code, format with stylua, README overhaul [NOTICE]: Moved this to DrKJeff16/project.nvim Sep 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant