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

Allow the use of underscore (rather than hyphen) to specify languages in settings #314

Open
henri-gasc opened this issue Oct 23, 2024 · 0 comments
Labels
1-feature-request ✨ Issue type: Request for a desirable, nice-to-have feature

Comments

@henri-gasc
Copy link

Is your feature request related to a problem? Please describe.
I am using ltex-ls on neovim, and as such, it is configured using Lua. However, Lua does not support the use of hyphen in tables, and I need it to (for example) disable a rule in a language.

This code can not work:

disabledRules = {
	-- Work, but does not set en-* languages
	en = {
		"ARROWS",
	},

	-- Syntax error, can not use hyphen
	en-US = {
		"ARROWS",
	},

	-- Syntax error, can not use literal string as key
	"en-US" = {
		"ARROWS",
	},
},

Describe the solution you'd like
The solution would be allowing to replace the hyphen with an underscore in the configuration.

Describe alternatives you've considered
Other solutions includes:

  • On the user part:
    • Change the document language to something without hyphen in the name
    • Accept to not be able to disable or enable specific rules
  • On ltex-ls part:
    • Internally remove non-letter from language name and set the rules based on it (from en-US/en_US/en-("&'--__-US to enUS)
    • If the value of disabledRules is a string, read from the file whose name we set in it
@henri-gasc henri-gasc added the 1-feature-request ✨ Issue type: Request for a desirable, nice-to-have feature label Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1-feature-request ✨ Issue type: Request for a desirable, nice-to-have feature
Projects
None yet
Development

No branches or pull requests

1 participant