Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed deprecations, adapted some code, format with stylua, README overhaul #158

Open
wants to merge 62 commits into
base: main
Choose a base branch
from

Conversation

DrKJeff16
Copy link

@DrKJeff16 DrKJeff16 commented Jun 30, 2024

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.
---@field setup fun(options: ProjectOptions)

---@type Project
---@diagnostic disable-next-line:missing-fields
Copy link
Author

@DrKJeff16 DrKJeff16 Aug 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Line 17] Is this acceptable for you? Or would the code be better off without it?
I'm eager to know. My LSP was annoying me with warnings so I had to turn off specific warnings this way.

I'm using LuaLS as my LSP, plus lazydev.nvim as a much needed help.

- 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

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