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

Config File Location After emacs Install? #441

Open
fahall opened this issue Jul 17, 2018 · 3 comments
Open

Config File Location After emacs Install? #441

fahall opened this issue Jul 17, 2018 · 3 comments

Comments

@fahall
Copy link

fahall commented Jul 17, 2018

Where is the omnisharp configuration file located after running omnisharp-install-server from within emacs? I looked in ~/.emacs.d/.cache/omnisharp/server, but did not see anything resembling a configuration json.

edit: there may not be an omnisharp configuration json file. I mistook an omnisharp-vscode issue for an omnisharp one.

What I'd like to do:

When running omnisharp-code-format-entire-file, I'd like open braces to NOT get their own lines:

void MyFunction (){

}
@razzmatazz
Copy link
Contributor

@fahall is there any particular setting that you would like to set?

Actually I didn't know that omnisharp server has any option to specify configuration file. Is this a new feature?

I tried to check for any options for the server but it seems there is none to specify confugration file:

user@pc v1.31.1 (develop)$ pwd
/Users/user/.emacs.d/.cache/omnisharp/server/v1.31.1
user@pc v1.31.1 (develop)$ ./run  --help


Usage:  [options]

Options:
  -? | -h | --help           Show help information
  -s | --source              Solution or directory for OmniSharp to point at (defaults to current directory).
  -l | --loglevel            Level of logging (defaults to 'Information').
  -v | --verbose             Explicitly set 'Debug' log level.
  -hpid | --hostPID          Host process ID.
  -z | --zero-based-indices  Use zero based indices in request/responses (defaults to 'false').
  -pl | --plugin             Plugin name(s).
  -d | --debug               Wait for debugger to attach
  -stdio | --stdio           Use STDIO over HTTP as OmniSharp communication protocol.
  -lsp | --languageserver    Use Language Server Protocol.
  -e | --encoding            Input / output encoding for STDIO protocol.

@fahall
Copy link
Author

fahall commented Jul 30, 2018

@razzmatazz I am trying to set up the omnisharp-code-format-entire-file to use Stroustrup style braces (i.e. opening brace does NOT get newline). I can set this be the default as I type, but then if I run omnisharp-format-entire-file before saving, it puts the braces on their own line again. I had found this discussion on braces and newlines and thought there was an omnisharp settings file. Upon review, I was reading an issue for omnisharp-vscode and not just omnisharp.

@razzmatazz
Copy link
Contributor

razzmatazz commented Jul 30, 2018

With omnisharp-emacs, code style and syntax highlighting and parsing is done by the https://github.com/josteink/csharp-mode package (which can actually be used separately w/o omnisharp-emacs). Then, omnisharp-emacs provides language server integration with completion, xref and other functionality on top of csharp-mode.

csharp-mode uses cc-mode internally which exposes settings for code formatting. I.e. in my init.el I have:

  (defun sm-csharp-mode-setup ()
    (setq indent-tabs-mode nil)
    (setq c-syntactic-indentation t)
    (c-set-style "ellemtel")
    (setq c-basic-offset 4)
    (setq truncate-lines t)
    (setq tab-width 4)
    (local-set-key (kbd "C-c C-c") 'recompile))

  (add-hook 'csharp-mode-hook 'sm-csharp-mode-setup t)

Basically, I think c-set-style is what you are looking for and the options are listed here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants