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

Add settings.json linter documentation #3368

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shitchell
Copy link

Add a JSON example of how to enable linting in settings.json

Add a JSON example of how to enable linting in settings.json
@shitchell
Copy link
Author

As mentioned in #3366, I spent months trying to figure out how to get linting working. I definitely referenced the documentation, but there wasn't any clear documentation on how to set it up (via "linter": true in settings.json). This isn't to criticize, just to point out that some fools like myself might benefit from a little spoon-feeding in the linter readme :)

@@ -24,6 +24,14 @@ following filetypes and linters:
* **swift**: swiftc (MacOS and Linux only)
* **yaml**: yamllint

You can easily enable linting in your `settings.json` file:
Copy link
Contributor

@Andriamanitra Andriamanitra Jul 2, 2024

Choose a reason for hiding this comment

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

I would also mention the set linter on|off command which is the easier way to do this.

@Andriamanitra
Copy link
Contributor

This is already documented in help options:

Plugin options: all plugins come with a special option to enable or disable
them. The option is a boolean with the same name as the plugin itself.
By default, the following plugins are provided, each with an option to enable
or disable them:
* `autoclose`: automatically closes brackets, quotes, etc...
* `comment`: provides automatic commenting for a number of languages
* `ftoptions`: alters some default options depending on the filetype
* `linter`: provides extensible linting for many languages
* `literate`: provides advanced syntax highlighting for the Literate
programming tool.
* `status`: provides some extensions to the status line (integration with
Git and more).
* `diff`: integrates the `diffgutter` option with Git. If you are in a Git
directory, the diff gutter will show changes with respect to the most
recent Git commit rather than the diff since opening the file.
Any option you set in the editor will be saved to the file
~/.config/micro/settings.json so, in effect, your configuration file will be
created for you. If you'd like to take your configuration with you to another
machine, simply copy the settings.json to the other machine.

I guess it doesn't hurt to repeat the same thing in the plugins own help file, but should we then add it to the help for the other built-in plugins too? It is also worth mentioning that linter is enabled by default when the "linter" key is absent from settings.json.

@shitchell
Copy link
Author

This is already documented in help options:

Plugin options: all plugins come with a special option to enable or disable
them. The option is a boolean with the same name as the plugin itself.
By default, the following plugins are provided, each with an option to enable
or disable them:
* `autoclose`: automatically closes brackets, quotes, etc...
* `comment`: provides automatic commenting for a number of languages
* `ftoptions`: alters some default options depending on the filetype
* `linter`: provides extensible linting for many languages
* `literate`: provides advanced syntax highlighting for the Literate
programming tool.
* `status`: provides some extensions to the status line (integration with
Git and more).
* `diff`: integrates the `diffgutter` option with Git. If you are in a Git
directory, the diff gutter will show changes with respect to the most
recent Git commit rather than the diff since opening the file.
Any option you set in the editor will be saved to the file
~/.config/micro/settings.json so, in effect, your configuration file will be
created for you. If you'd like to take your configuration with you to another
machine, simply copy the settings.json to the other machine.

I guess it doesn't hurt to repeat the same thing in the plugins own help file, but should we then add it to the help for the other built-in plugins too? It is also worth mentioning that linter is enabled by default when the "linter" key is absent from settings.json.

I saw that, but the way I read it was more of these plugins with these names are available, and they each have some undisclosed setting name to enable/disable them. Especially since each key is followed by a description, that read more like a list of plugin names and descriptions than keys that go in the settings.json file.

There is also a sample settings.json file provided that includes the "linter" setting, but I simply didn't see it in the list. That could be me being blind, and perhaps most people are more observant than me lol, and if so then it might be unnecessarily redundant to add here as well. I do think having it in the linter docs would've saved me, though :P

It is also worth mentioning that linter is enabled by default when the "linter" key is absent from settings.json.

That just makes me feel even more braindead... I probably copied all the settings to my settings.json (as reference for what all the options are), manually set that one to false for some reason, and then forgot about it. Probably ~2 years ago. And I share my configs across devices, so it wasn't working on anything... 🤦

but should we then add it to the help for the other built-in plugins too?

If that makes this addition make more sense, I'd be happy to do that :) Or if others feel this is indeed unnecessary redundancy, that's fair, too 😛

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