omnisharp-emacs
omnisharp-emacs copied to clipboard
Config File Location After emacs Install?
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 (){
}
@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.
@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.
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:
- https://www.emacswiki.org/emacs/IndentingC#toc2