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

How to provide options_file for ycmd? #479

Open
ChoppinBlockParty opened this issue Aug 31, 2018 · 5 comments
Open

How to provide options_file for ycmd? #479

ChoppinBlockParty opened this issue Aug 31, 2018 · 5 comments

Comments

@ChoppinBlockParty
Copy link

ycmd has an option --options_file that is a json file with a lot of helpful options? For every ycmd start it is suppose to be created once, because of an HMAC secret inside. How does emacs-ycmd is handling this? Can I provide a file with my custom options for this? Should I handle this manually in my emacs configuration: creating a temporary file from a template, and providing as an option to ycmd-server-command?

@abingham
Copy link
Owner

abingham commented Sep 3, 2018

We don't have great support for custom options right now. You can look at ycmd--options-contents to see what we're doing right now. We haven't really given this topic much thought, and we could probably do something more sophisticated (though I'd want to make sure the default behavior is simple). Do you have any specific needs? Or do you have any ideas on what we should do? It might be useful for us to look at what e.g. the vim client does.

BTW, my responses will be slow for the next week as I'm on vacation.

@ChoppinBlockParty
Copy link
Author

ChoppinBlockParty commented Sep 7, 2018

I see that the file contains a lot of valuable options. I would really think that is more simple to configure server in client-independent way, rather than port all the options into emacs. So my idea is to pass a file path to emacs-ycmd that points to a JSON file with all necessary options. Then it can read the file add a value to hmac_secret, write a temporary file, pass this file to ymcd server.

Some options like filetype_blacklist make me a little bit doubtful how well they will work, because seems like they are vim specific.

@abingham
Copy link
Owner

abingham commented Sep 7, 2018

Yes, this could work. We need to provide reasonable default behavior like we do now; I don't want to require people to make this file. But users could specify a file that we layer on top of these defaults.

I probably won't have time to put into this for a while. Do you have the time to work on this?

Some options like filetype_blacklist make me a little bit doubtful how well they will work, because seems like they are vim specific.

I'm not sure if this will be a problem, though my instinct is that it won't be an issue.

@ChoppinBlockParty
Copy link
Author

I have recently switched after 8 years of vim to emacs. I am still learning lisp and spend a lot of time trying researching Emacs. Though, I will try to do it someday, if no one is working on it.

@abingham
Copy link
Owner

I have recently switched after 8 years of vim to emacs

Welcome!

I am still learning lisp and spend a lot of time trying researching Emacs. Though, I will try to do it someday, if no one is working on it.

If you're interested in learning emacs lisp (which is both awful and very rewarding), this could be a good place to start. And I'd be happy to help you work through it. I don't think it would be very hard: a new variable for the user's options file, a check to see if that variable is set, and the code to merge their options into the default options.

Right now, nobody that I know of is working on this, and you're the only person who has expressed interest in a feature like this.

ChoppinBlockParty added a commit to ChoppinBlockParty/emacs-ycmd that referenced this issue Oct 18, 2018
Add `ycmd-settings-json-filepath` - path to YCMD settings JSON file.
YCMD accepts a json file where the server settings are set, including
a one-time HMAC. The file is deleted after the server starts.
As for now, emacs-ycmd was just creating a temporary file from
some hard-coded/customizable values.
Since those settings have to direct relation to emacs-ycmd, rather
only to YCMD, it is good idea to keep it this way and just feed the
file adding an HMAC value.

That change will read the JSON file, insert HMAC and pass it to YCMD.
Please, test it, feedback is appreciated, I will mainly test it on
C/C++ and Go.

That is supposed to solve abingham#472, abingham#479.
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

No branches or pull requests

2 participants