-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Don’t perform actions when no configuration is found. #30
Comments
|
This alternative sounds good.
Having used the prettier plugin having the option was nice, what in particular do you see as a risk/burden for its use with remark/unified? |
I now think what I previously called burden, is better called control. I suggest to add the following options:
This means by default users only get remark language server functionality remark in the projects where remark has been configured. However, users can forcefully disable it on a project basis or enable the language server where no remark configuration exists (useful for formatting only). |
I think it makes sense too. For the (neo)vim side of things, it wouldn't be too hard to add the same options as in vscode and pass them down. I'm wondering what would the language server do when |
In this case it will do formatting, but effectively no diagnostics. (It will do diagnostics, but remark will never actually emit any. Other language servers implementing |
(Boolean) APIs are typically easier to understand if they default to I believe that it’s weird for default behavior of “The language server only perform diagnostics and formatting if a configuration file is found”. unified formats code and does not need configuration to do so.
If you imagine them being passed as parameters, then I don’t see the need for this project to support |
I don’t think it’s wrong to default to true. Naming it
I think it’s important to listen to the feedback from the community. This feature is in demand.
The big difference between
This would be a new option of
Options are part of LSP. They are defined in
If this were the case, then I’d agree. |
I’m okay with checkboxes in VS Code’s UI.
I don’t see it. I am talking about defaults. Vim being broken can be solved regardless of what the default is. Vim being solved is in demand.
This compares apples and oranges.
Do you mean |
I do think it’s fair to compare with VSCode extensions settings, as many of them simply wrap a language server which defines those settings, just like is the case with this project. Also VSCode represents it’s settings as a JSON file. I just used that, because it’s autocomplete is a convenient way to search for similar settings.
I miss this feature as an end user using this via both Vim and VSCode. Just like I don’t want to have Prettier format my code in a project without Prettier configuration, I don’t want to have remark format my code in a project without a remark configuration. This is where the I have changed my mind about the
I think that’s it. This is at a lower level though. I’m still thinking of this feature at a higher level. I’d need to fiddle with this to make sure. This is how it should work: VSCode users can define the following in their {
// …
"remark.requireConfig": true,
// …
} The VSCode extension should declare this configuration option using JSON schema. Based on require'lspconfig'.remark_ls.setup{
settings = {
requireConfig = true
}
} I thought createUnifiedLanguageServer({
+ configurationPrefix: 'remark', // Previously referenced to as `prefix`
ignoreName: '.remarkignore',
packageField: 'remarkConfig',
pluginPrefix: 'remark',
processorName: 'remark',
processorSpecifier: 'remark',
rcName: '.remarkrc'
}) In Personally I would recommend anyone to enable this option, but I don’t really mind what the default is. Also clients can set their own defaults. |
I like how |
To reiterate what I try to voice: I am okay with supporting this feature in this language server. It makes sense for tools that do nothing by default (such as ESLint, which does default to this in at least Atom). It doesn’t make sense for tools to do things by default. unified does things by default. And it makes sense for editors that can only install all tools at once (Vim). But in Atom and VS Code, people choose to install a remark extension. They opt-into remark by installing a remark extension.
I am not opposing such comparison. This issue is in |
That's not how things happen in Vim, this was just someone's opinion. Most things in nvim-lspconfig use |
Is it correct that your statement describes how nvim but not vim-lspconfig works? I.e., taking this quote:
remark was removed there because vim-lspconfig did not have this feature as I understand it?
Regardless, you seem to describe that nvim currently has the “requireConfig” option, that we are discussing here, built in, correct? |
Sort of, but the LS would always be enabled when it finds a config file and otherwise not. So it's not an option to enable it based on user preference. And it's also only tied to
So it seems we only need |
|
Ideally
Perhaps
Yes, these options are received from
This is the responsibility of the client. (I believe they are typically shallow merged.)
We could for example allow users to configure remark through configuration. I would use a configuration file, but I wouldn’t be surprised to get a feature request for this. I.e.: // VSCode settings.json
{
"remark.requireConfig": false,
"remark.config": {
"settings": {
"bullet": "-"
},
"plugins": [
"remark-gfm",
"remark-preset-lint-recommended"
]
}
} -- Neovim init.lua
require'lspconfig'.remark_ls.setup{
settings = {
requireConfig = true,
config = {
settings = {
bullet = '-'
},
plugins = {
'remark-gfm',
'remark-preset-lint-recommended'
}
}
}
} Other options that come to mind are to disable specific features, such as formatting, diagnostics, or code actions. Perhaps a user wishes to disable message notes, change severity levels, filter diagnostics based on rule name, or alter the diagnostics output in some other way. I don’t intend to implement any of these options (until there is user demand). I’m just thinking of potential future configuration options. |
Looking at the options in
How does that work with different workspaces? It seems like there’s only one configuration that can be retrieved/listened to, instead of per workspace/file?
Rest of the options: 👍, later. |
I like it! I keep changing my mind whether
My bad,
It’s not an option I would encourage for the same reasons you mentioned. It’s just an example of a possible future configuration I could think of which is a bit more complex than a simple boolean field, so I figured this might give an idea of what such configurations would look like for end users. It’s also effectively what the old VSCode remark extension already did. Just as for the other options, I have no intent to implement this unless there is user demand. |
Sweet. Looks like we have a plan! :) |
This comment has been minimized.
This comment has been minimized.
When turning this option on, files will only be used if they have an associated detected configuration file. Other files will be ignored. Given that configuration actually happens much later than finding files, how it works is more similar to how a fatal error or so prevents a file from being processed, instead of actual files being ignored. Related-to: unifiedjs/unified-language-server#30.
When turning this option on, files will only be used if they have an associated detected configuration file. Other files will be ignored. Given that configuration actually happens much later than finding files, how it works is more similar to how a fatal error or so prevents a file from being processed, instead of actual files being ignored. Related-to: unifiedjs/unified-language-server#30.
Related-to: unifiedjs/unified-language-server#30. Closes GH-64. Reviewed-by: Christian Murphy <[email protected]> Reviewed-by: Remco Haszing <[email protected]>
Initial checklist
Problem
Comments in neovim/nvim-lspconfig#1606, neovim/nvim-lspconfig#1641, and mattn/vim-lsp-settings#527 show that users don’t know what remark is. When they open a markdown file, they are prompted to enable
remark-language-server
. When they do enable it, they are prompted with a message to installremark
.Also VS Code users are going to run into this issue. They will install the extension to get the functionality in projects that use remark, but the extension will show a prompt every time they open a project which doesn’t use remark.
Solution
Don’t perform actions for workspaces where no remark configuration is found.
To accomplish this, the logic for resolving a configuration needs to be exposed in
unified-engine
.Alternatives
An alternative would be to add language server settings. This allows the user to specify at least VS Code users to define settings to enable or disable certain features per project.
This would be similar to
prettier.enable
andprettier.requireConfig
inprettier-vscode
.This puts control, but also burden in the hands of the users.
The text was updated successfully, but these errors were encountered: