Skip to content

Commit

Permalink
Merge pull request #29 from creativenull/feat-automate-docs
Browse files Browse the repository at this point in the history
feat(doc): automate docs, new defaults impl
  • Loading branch information
creativenull authored Aug 11, 2023
2 parents 7458e5c + abf749c commit e4381c1
Show file tree
Hide file tree
Showing 100 changed files with 2,411 additions and 1,779 deletions.
51 changes: 51 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Contributing

## Requirements

- [stylua](https://github.com/JohnnyMorganz/StyLua) - for formatting
- [deno](https://deno.land/) - for documentation generation

## Add a tool (linter/formatter)

1. Read thru the efm-langserver readme and the schema to understand the structure. Additionally, you can go thru the
`linters/*.lua`/`formatters/*.lua` files to see examples and copy and paste the code and adjust them.

2. Add the metadata information above the file so that we can generate documentation for it. To end the metadata info,
you must add a blank line after. Again follow the examples in any `linters/*.lua`/`formatters/*.lua` files.

```lua
-- Metadata
-- languages: langA,langB,langC
-- url: http://example.com


```

## Add a tool to `default_config` option

Users that use the `default_config` (`:help efmls-configs-defaults`) follow the tools registered in `lua/efmls-configs/defaults.json`.
If you want to add a tool for a language that is not defined, then this json file is the place to add them.

The linter/formatter name you add should match the filename in the `lua/efmls-configs/linters`/`lua/efmls-configs/formatters`
directory. For example, adding eslint to an html filetype. The following values in the `linters` property should match
`lua/efmls-configs/linters/eslint.lua`.

```json
{
"defaults": [
{
"languages": ["html"],
"linters": ["eslint"]
}
]
}
```

## Auto-generating Documentation

Never touch the [`doc/SUPPORTED_LIST.md`](./doc/SUPPORTED_LIST.md)to add documentation for the tool you've add, to
create documentation for run the following:

```sh
deno task gen
```
29 changes: 17 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
# efmls-configs-nvim

<a href="https://dotfyle.com/plugins/creativenull/efmls-configs-nvim">
<img src="https://dotfyle.com/plugins/creativenull/efmls-configs-nvim/shield"
alt="Configs on dotfyle">
<img src="https://dotfyle.com/plugins/creativenull/efmls-configs-nvim/shield" alt="Configs on dotfyle">
</a>

An unofficial collection of linters and formatters configured for [efm-langserver][efm-langserver] to work with the
built-in [nvim-lsp][nvim-lsp]. Works only for Neovim >= 0.5.

## Supported linters and formatters

Check out [supported-linters-and-formatters.md](supported-linters-and-formatters.md)
Check out [SUPPORTED_LIST.md](./doc/SUPPORTED_LIST.md)

## Features

+ Out-of-box configurations for 70+ linters & formatters
+ Intelligently detect tools installed project-wide or system-wide - works only for node/npm, php/composer and
ruby/bundler (additional support for other build tools coming soon)
+ Use `:checkhealth` for a quick diagnostic on tools, to check if tool is available
+ Ability to customize configurations for your specific project use-cases (see [Advanced Setup](#advanced-configuration-setup-help-efmls-configs-advanced))
+ Ability to customize configurations for your specific project use-cases (see [Advanced Setup](#advanced-configuration-setup))

## Vim Docs

Expand All @@ -39,31 +38,33 @@ Install with your favorite plugin manager or just use builtin packages.
```lua
{
'creativenull/efmls-configs-nvim',
version = 'v0.1.3',
version = 'v0.2.x', -- tag is optional
dependencies = { 'neovim/nvim-lspconfig' },
}
```

### Packer.nvim
### packer.nvim

```lua
use {
'creativenull/efmls-configs-nvim',
tag = 'v0.1.3', -- tag is optional
tag = 'v0.2.*', -- tag is optional
requires = { 'neovim/nvim-lspconfig' },
}
```

### Vim-plug
### vim-plug

```vim
Plug 'neovim/nvim-lspconfig'
Plug 'creativenull/efmls-configs-nvim', { 'tag': 'v0.1.3' } " tag is optional
Plug 'creativenull/efmls-configs-nvim', { 'tag': 'v0.2.*' } " tag is optional
```

## Documentation

### Setup (`:help efmls-configs-setup`)
### Setup

See also `:help efmls-configs-setup` to view inside neovim.

#### Step 1

Expand Down Expand Up @@ -103,7 +104,9 @@ efmls.setup {
}
```

### Default Configuration (`:help efmls-configs-defaults`)
### Default Configuration

See also `:help efmls-configs-defaults` to view inside neovim.

A default configuration for the supported filetypes is provided but not activated by default.

Expand All @@ -125,7 +128,9 @@ You will still need to call the `setup()` after `init()` for the changes to take
configurations to `setup()` as show in the [Setup section](#setup) and it will override any default configuration set
by `default_config` if it's the same filetype.

### Advanced Configuration Setup (`:help efmls-configs-advanced`)
### Advanced Configuration Setup

See also `:help efmls-configs-advanced` to view inside neovim.

If you want to change some settings that are not provided in the default config, you can change them with `vim.tbl_extend`.
These configs take the same keys referenced in the [efm-langserver schema file][schema-file] in json format, aka
Expand Down
8 changes: 8 additions & 0 deletions deno.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"tasks": {
"gen": "deno run --allow-read=lua/efmls-configs --allow-write=doc/SUPPORTED_LIST.md generate.ts"
},
"fmt": {
"lineWidth": 100
}
}
4 changes: 4 additions & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e4381c1

Please sign in to comment.