abingham / emacs-ycmd

Emacs client for ycmd, the code completion system.
MIT License
384 stars 46 forks source link

How to provide options_file for ycmd? #479

Open ChoppinBlockParty opened 5 years ago

ChoppinBlockParty commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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.