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

FYI: How to use completion in non-Rider IDE #9

Open
PiotrZierhoffer opened this issue Apr 27, 2021 · 2 comments
Open

FYI: How to use completion in non-Rider IDE #9

PiotrZierhoffer opened this issue Apr 27, 2021 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@PiotrZierhoffer
Copy link

You can take a look at https://github.com/betrusted-io/xous-core/tree/master/emulation#editing-renode-peripherals

It boils down to creating a specifc csproj that has proper references. I have not tested it, but you might be able to employ this approach if needed.

@John15321
Copy link
Member

No tweaks to any .csproj files are needed. I managed to make IntelliSense work on VSCode with 3 things:

  1. Make sure you have installed needed .NET SDKs etc, and mono. Also make sure that they are correctly added to your path so for example when you execute:
$ dotnet --info
.NET SDK (reflecting any global.json):
 Version:   5.0.202
 Commit:    db7cc87d51

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  20.04
 OS Platform: Linux
 RID:         ubuntu.20.04-x64
 Base Path:   /usr/share/dotnet/sdk/5.0.202/

Host (useful for support):
  Version: 5.0.5
  Commit:  2f740adc14

.NET SDKs installed:
  3.1.408 [/usr/share/dotnet/sdk]
  5.0.202 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.14 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.5 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.14 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.5 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download

You can see your .NET SDKs etc.
The same with mono:

$ mono --version
Mono JIT compiler version 6.12.0.122 (tarball Mon Feb 22 17:29:18 UTC 2021)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	Interpreter:   yes
	LLVM:          yes(610)
	Suspend:       hybrid
	GC:            sgen (concurrent by default)
  1. Install the C# extension and configure it.
    You have to tweak 2 settings in this extension:

Set it to use your global mono (in your User settings). By either adding this JSON line to your config:

"omnisharp.useGlobalMono": "always"

Or just toggle it in the settings:

image

  1. Then make sure that your default project solution is set to Renode.sln. by either adding this JSON line to your local .vscode/settings.json:
"omnisharp.defaultLaunchSolution": "Renode.sln"

Or do it using VSCodes GUI for settings like so (just make sure that you are in the Workspace tab, otherwise Omnisharp will try to start every C# project you open in VSCode with a Renode.sln solution):

image

After following these 3 steps you should restart VSCode, after that it will probably prompt you about a few problems but you should ignore them, but also agree if its asking to "Restore" some missing dependencies, etc. Open a .cs file (for example: renode/src/Renode/Network/NetworkServer/NetworkServer.cs, for it to fully parse the renode project it needs a few minutes so just wait. When it finished your VSCode should look something like that, with references, authors, etc shown:

image

and when you hover over a function or ash VSCode to get you to its Definition etc it also should work:

image

@John15321 John15321 added the documentation Improvements or additions to documentation label May 9, 2021
@PiotrZierhoffer
Copy link
Author

I confirm this works. We'll consider how to put it in our docs, thanks

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

No branches or pull requests

2 participants