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

feat(treesitter): add styles.miscs to disable hardcoded italics #659

Merged
merged 3 commits into from
Feb 24, 2024
Merged

feat(treesitter): add styles.miscs to disable hardcoded italics #659

merged 3 commits into from
Feb 24, 2024

Conversation

GotaLoveFiraCode
Copy link
Contributor

Set everything to O.styles.conditionals or { "italic" }, so, by default, the various settings are still italic. In other words, this is not a breaking change.

🎉 First off, thanks for taking the time to contribute! 🎉

Here are some guidelines:

  • Format code using stylua.
  • New plugin integration should be added in alphabetical order:
  • Create a topic branch on your fork for your specific PR.
  • Use conventionalcommits.org's
    rules for explicit and meaningful commit messages.
  • If it's your first time contributing to a project, then read
    About pull requests
    on Github's docs.

Here are some tips:

  • Use vim.g.catppuccin_debug = true to get live config re-loading

Set everything to `O.styles.conditionals or { "italic" }`, so, by
default, the various settings are still italic. In other words, this is
not a breaking change.
@mrtnvgr
Copy link
Contributor

mrtnvgr commented Feb 15, 2024

Catppuccin compiles your configuration to simple colors, it helps to reduce start up time. no_italic (as well as other no_... options) removes all italic from highlight groups on compile time. If you still have italics, we should debug that code.

["@module"] = { fg = C.lavender, style = { "italic" } }, -- For identifiers referring to modules and namespaces.
-- This is difficult to avoid hardcoding, as there is no user option for this (yet).
-- For now, binding to `conditionals` because it is italic by default.
["@module"] = { fg = C.lavender, style = O.styles.conditionals or { "italic" } }, -- For identifiers referring to modules and namespaces.

Choose a reason for hiding this comment

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

This isn't a conditional though?. You can always just style = {} in userconfig or is it not

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This precisely is the problem; the user’s config does not override this setting. That’s what I changed, by binding the setting for @module to the users setting for conditionals (which, by default, is also italic). This way the user can change if modules are italic or not, while the default of italic is still preserved.

@GotaLoveFiraCode
Copy link
Contributor Author

GotaLoveFiraCode commented Feb 18, 2024

Catppuccin compiles your configuration to simple colors, it helps to reduce start up time. no_italic (as well as other no_... options) removes all italic from highlight groups on compile time. If you still have italics, we should debug that code.

Hello! Sorry for taking so long to reply, I’ve been traveling.
When setting no_italic, everything works as expected.
What I am trying to fix with this PR is that it is impossible to control the italics that catppuccin’s treesitter integration sets. An example is anything treesitter thinks of as a module will become italic (e.g. in mod somemodule in rust, the somemodule would be italic), even if the user doesn’t want it to be italic. Currently, the only option is to have all modules (among other things) be italic, or turn italics off completely with no_italic—there is no way for the user to control modules specifically. Ideally, there should be a setting in styles in the setup call, so the user can control, independently of catppuccin’s treesitter integration, if modules should be italic or not. For now, though, setting modules to the users conditionals setting is easier and keeps the same default.

@rewhile rewhile changed the title fix(treesitter): Fixed most hardcoded italics. (quick-fix, not permament) feat(treesitter): add styles.miscs to disable hardcoded italics Feb 24, 2024
@rewhile rewhile merged commit c0de3b4 into catppuccin:main Feb 24, 2024
9 checks passed
@rewhile
Copy link
Contributor

rewhile commented Feb 24, 2024

You can now do

require("catppuccin").setup { styles = { miscs = {} } }

To disable the remaining hardcoded styles

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.

4 participants