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

Improvements to types and testing #12

Merged
merged 1 commit into from
Feb 4, 2024

Conversation

mikavilpas
Copy link
Contributor

Here are some updates that don't add new features, but should make maintaining the project and contributing to it that much easier:

refactor(types): add explicit types

No runtime change, but maybe slightly easier to understand and maintain the code.


chore: all development dependencies are locked and reliably installable

This is a change that builds on the base of the build system I worked on a few days ago. It adds the following improvements:

  • the exact versions of all testing dependencies are stored within the project (previously they were outside).
    • the versions are stored in a lock file. I used https://github.com/folke/lazy.nvim because it's the only modern one I know.
    • lazy.nvim is used both to install and maintain the dependencies, as well as loading them when it's time to test.

feat(development): controlled playground nvim instance

This is a side effect of the previous one. The testing setup can also be used to launch a minimal nvim that can be used to try the plugin out.

  • idea: in the future, it could be used to reproduce bugs or collaborate with developers

Here is a mini demo. In the demo, I first install dependencies (according to the lock file) and then run tests.

Untitled.mov

docs: contribution instructions

These are pretty basic but should cover the essentials.

@mikavilpas
Copy link
Contributor Author

I would really like to hear what you think about these ideas, especially if you'd like to take the project in another direction in some way.

I wasn't able to find a similar/simple example in the nvim plugin developer community, so I hacked something together myself 😄

I think in general, a simple "how to get started" experience would be good, but I am not sure the specifics are good fits, etc.

@mikavilpas mikavilpas force-pushed the feature/expose-programmatic-api branch 2 times, most recently from 922b771 to 3780a17 Compare January 29, 2024 19:44
@mikavilpas
Copy link
Contributor Author

Hmm looks like I forgot to make the test environment initialization quit neovim - now it probably can't proceed automatically. I can fix this later.

@gsuuon
Copy link
Owner

gsuuon commented Jan 31, 2024

Hey sorry I've been a bit busy lately, I haven't forgotten about these and I'll take a look this weekend.

@gsuuon
Copy link
Owner

gsuuon commented Feb 3, 2024

This project is meant to be a really small, simple plugin - I think this overcomplicates setup. Plenary is the only testing dependency. We don't need nvim-treesitter or tree-sitter-lua as dependencies since neovim ships with treesitter and a lua parser. This plugin doesn't ever do anything language specific (we won't do queries) so the built-in stuff is all we'll ever need for testing.

I don't think a contributing guide is necessary in this project since there shouldn't be any dev setup. I do think the types will be useful here, but the rest are overkill for this project.

For plugin examples, I usually take a look at the bigger neovim plugins (like lazy or telescope) and check their github workflows. I think the ideas in this PR would be good to explore in a separate experimental repo for neovim dev things, though for consistency I'd lean more towards a dev container than lazy + lockfile (so you can pin the neovim version as well). It's not generally necessary though since neovim plugins don't have deep dependency trees.

Copy link
Owner

@gsuuon gsuuon left a comment

Choose a reason for hiding this comment

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

Lets just stick to adding types here

local function toggle(outermost)
return function()
print('HELLO WORLD')
Copy link
Owner

Choose a reason for hiding this comment

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

Make sure to strip this out as well!

@mikavilpas mikavilpas force-pushed the feature/expose-programmatic-api branch from 3780a17 to 3ad61e2 Compare February 3, 2024 16:39
@mikavilpas
Copy link
Contributor Author

Lets just stick to adding types here

I made some changes and only left the type additions in.

Copy link
Owner

@gsuuon gsuuon left a comment

Choose a reason for hiding this comment

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

Thanks!

@gsuuon gsuuon merged commit c598817 into gsuuon:main Feb 4, 2024
5 checks passed
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.

2 participants