OmniSharp / omnisharp-emacs

Troll coworkers - use Emacs at work for csharp!
GNU General Public License v3.0
514 stars 94 forks source link

File mode specification error (Windows 10) #494

Closed aks2161989 closed 5 years ago

aks2161989 commented 5 years ago

I installed omnisharp-emacs from MELPA and set up my configuration as given in the Readme.md. Whenever I open a saved C# file, the minibuffer shows the message:

File mode specification error: (void-function company-mode)

Also, whenever I type M - x csharp-mode in the scratch buffer, I get the message:

Symbol's function definition is void: company-mode

Why am I getting these errors?

I have added the following lines to the end of my init.el as the Readme.md says:

;; Add this to csharp-mode-hook to your init.el to automatically invoke omnisharp-emacs when opening C# files:
(add-hook 'csharp-mode-hook 'omnisharp-mode)

;; For autocompletion via company mode to work you will also need this in your init.el:
(eval-after-load
 'company
 '(add-to-list 'company-backends 'company-omnisharp))

(add-hook 'csharp-mode-hook #'company-mode)

;;omnisharp-emacs supports Flycheck and it can be enabled automatically by hooking up flycheck-mode to be enabled for csharp-mode buffers:
(add-hook 'csharp-mode-hook #'flycheck-mode)

Thanks

razzmatazz commented 5 years ago

Hi @aks2161989 omnisharp-emacs does not have a hard requirement on `company-mode'. However instructions on readme that reference company-mode actually require for you to install company mode manually.

Sorry if this was not clear. I will try updating the README.md

aks2161989 commented 5 years ago

Hi @razzmatazz Thank you for the clarification. I installed company-mode and now it does not show any errors. However, I am a beginner who writes simple console C# programs (single .cs files). How can I turn on autocorrect/autocomplete on single .cs files? I do not create projects.

Thanks