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

Complete example under Advanced Usage not working #29

Closed
rnmmnen opened this issue Oct 8, 2023 · 1 comment
Closed

Complete example under Advanced Usage not working #29

rnmmnen opened this issue Oct 8, 2023 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@rnmmnen
Copy link

rnmmnen commented Oct 8, 2023

I run into type errors on the last line of the Complete example when following the Advanced Usage documentation.

My LSP detected the errors as the following:

Diagnostics:
1. Cannot assign `string` to parameter `table?`.
   - `string` cannot match `table?`
   - Type `string` cannot match `nil`
   - Type `string` cannot match `table` [param-type-mismatch]
2. This function expects a maximum of 1 argument(s) but instead it is receiving 3. [redundant-parameter]
3. This function expects a maximum of 1 argument(s) but instead it is receiving 3. [redundant-parameter]

Ignoring these and running :colorscheme NAME resulted in the following error:

Error detected while processing /Users/REDACTED/.config/nvim/colors/REDACTED.lua:
E5113: Error while calling lua chunk: vim/shared.lua:0: Expected table, got string
stack traceback:
        [C]: in function 'assert'
        vim/shared.lua: in function 'tbl_isempty'
        ...cal/share/nvim/lazy/nvim-highlite/lua/highlite/table.lua:7: in function 'is_empty'
        ...ocal/share/nvim/lazy/nvim-highlite/lua/highlite/init.lua:125: in function 'setup'
        /Users/REDACTED/.config/nvim/colors/REDACTED.lua:57: in main chunk

When peeking at the referenced line of code, it seems the documentation does not match the code, because setup() indeed expects only a single table as an argument.

I'm using nvim-highlite v4.12.0 installed via lazy.nvim 10.8.1 on Nvim v0.9.2.

To reproduce:

  • Copy the example code into a new Lua file under your local colors directory
  • Supply colors for the light variant (for example, copy from the dark variant)
  • Run :colorscheme BASENAME_OF_YOUR_NEW_FILE
@Iron-E
Copy link
Owner

Iron-E commented Oct 8, 2023

Good catch! I will have to update the documentation. setup should be generate there:

  • setup configures the output of generate, and should (optionally) be run by users.
  • generate applies the colorscheme, and is meant for use by colorscheme authors.

See this snippet from my config for a working example.

@Iron-E Iron-E added the documentation Improvements or additions to documentation label Oct 8, 2023
@Iron-E Iron-E self-assigned this Oct 8, 2023
@Iron-E Iron-E closed this as completed in 50882b4 Oct 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants