-
Notifications
You must be signed in to change notification settings - Fork 196
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
WIP: Configuration file support #338
base: master
Are you sure you want to change the base?
Conversation
Add a user configuration file that is read on startup. Change the server settings to always be fully fleshed out. So the ElixirLS.LanguageServer.Server state `settings` always has all the settings (and as atoms) instead of being an empty map by default. This consolidates the default setting logic into the new `ConfigParser` module instead of being strewn about the Server. TODO: - [ ] Fix tests (I'm getting a strange error with the tests that I cannot figure out.) - [ ] Read a configuratioon file from the repository Note: Editor configuration always overrides the configuration file, and the VSCode extension always sends in the full configuration. This means that the configuration file is not currently useable with the VSCode extension. This will probably have to be modified in the VSCode extension because I think it is important for the extension to have the final control of the server settings.
alias ElixirLS.Utils.ConfigParser | ||
alias ElixirLS.LanguageServer.JsonRpc | ||
|
||
# Can we change this to load also from the workspace root? Note: might need multiple passes for that to work |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to remove this comment before merging
|> String.split(["\n", "\r", "\r\n"], trim: true) | ||
|> Enum.map(&String.trim/1) | ||
# Ignore json comments | ||
|> Enum.reject(&String.starts_with?(&1, "#")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vscode jsonc (JSON with comments) supports JS style comments only (//
and /**/
), see https://code.visualstudio.com/docs/languages/json#_json-with-comments
https://github.com/Microsoft/node-jsonc-parser
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haha, good catch. I've obviously haven't been doing very much js development recently. However since we're not using a full processor I don't think it's feasible to support multi line comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. A simple full line comment support is good enough.
@@ -0,0 +1,7 @@ | |||
# This is the configuration file for ElixirLS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment should be //
as @lukaszsamson comment above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, fixed!
@@ -0,0 +1,7 @@ | |||
# This is the configuration file for ElixirLS | |||
{ | |||
# Disable dialyzer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one should be //
also.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
@axelson how far is this from being done? |
@lukaszsamson Hmmm, I think it was fairly close at the time, but I think it's pretty out of date now so I don't know how much work would be required to bring it up to date. I also probably won't be able to dedicate time to it in the near future. |
Add a user configuration file that is read on startup.
Change the server settings to always be fully fleshed out. So the
ElixirLS.LanguageServer.Server state
settings
always has all thesettings (and as atoms) instead of being an empty map by default. This
consolidates the default setting logic into the new
ConfigParser
module instead of being strewn about the Server.
TODO:
Note: Editor configuration always overrides the configuration file, and
the VSCode extension always sends in the full configuration. This means
that the configuration file is not currently useable with the VSCode
extension. This will probably have to be modified in the VSCode
extension because I think it is important for the extension to have the
final control of the server settings.
Fixes #60