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

Did the steps change meanwhile? IntelliSense problem #1

Open
ArcticSnowSky opened this issue Dec 17, 2020 · 9 comments
Open

Did the steps change meanwhile? IntelliSense problem #1

ArcticSnowSky opened this issue Dec 17, 2020 · 9 comments

Comments

@ArcticSnowSky
Copy link

Hi,

I wanted to start writing code outside of game, however it seems I'm out of luck.
My example code I try to use intellisense on:
public void Main(string args) {
GridTerminalSystem.
}

So I installed VSCode, OmniSharp C# Extension, .NET Sdk 5.0.101, devpack 4.6.1 in this order.
Changed the SpaceEngineers Path to D:... in the csproj file.
It didn't work so I added NuGet Package manager Extension, but that didn't change anything.

P.S.: the last lines are written when trying to use IntelliSense
(info: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionService
Could not find document for file d:\Users\SnowSky\Projekte\VSC-SE-master\SpaceEngineers\rocket_test.cs)

As this "Project" is two years old, are there maybe things that changed?

I would really appreciate some help :)

My OmniSharp Output:
`Starting OmniSharp server at 17.12.2020, 21:27:13
Target: d:\Users\SnowSky\Projekte\VSC-SE-master\SpaceEngineers.sln

OmniSharp server started.
Path: c:\Users\SnowSky.vscode\extensions\ms-dotnettools.csharp-1.23.8.omnisharp\1.37.5\OmniSharp.exe
PID: 13800

Starting OmniSharp on Windows 6.2.9200.0 (x64)
info: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: StandAlone 16.8.0 - "c:\Users\SnowSky.vscode\extensions\ms-dotnettools.csharp-1.23.8.omnisharp\1.37.5.msbuild\Current\Bin"
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to 'c:\Users\SnowSky.vscode\extensions\ms-dotnettools.csharp-1.23.8.omnisharp\1.37.5.msbuild\Current\Bin\MSBuild.exe'
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: StandAlone 16.8.0 - "c:\Users\SnowSky.vscode\extensions\ms-dotnettools.csharp-1.23.8.omnisharp\1.37.5.msbuild\Current\Bin"
CscToolExe = csc.exe
CscToolPath = c:\Users\SnowSky.vscode\extensions\ms-dotnettools.csharp-1.23.8.omnisharp\1.37.5.msbuild\Current\Bin\Roslyn
MSBuildExtensionsPath = c:\Users\SnowSky.vscode\extensions\ms-dotnettools.csharp-1.23.8.omnisharp\1.37.5.msbuild
MSBuildToolsPath = c:\Users\SnowSky.vscode\extensions\ms-dotnettools.csharp-1.23.8.omnisharp\1.37.5.msbuild\Current\Bin
info: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in 'd:\Users\SnowSky\Projekte\VSC-SE-master'.
info: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
info: OmniSharp.MSBuild.ProjectSystem
Detecting projects in 'd:\Users\SnowSky\Projekte\VSC-SE-master\SpaceEngineers.sln'.
info: OmniSharp.MSBuild.ProjectManager
Queue project update for 'd:\Users\SnowSky\Projekte\VSC-SE-master\SpaceEngineers\SpaceEngineers.csproj'
info: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in 'd:\Users\SnowSky\Projekte\VSC-SE-master'.
info: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
info: OmniSharp.MSBuild.ProjectManager
Loading project: d:\Users\SnowSky\Projekte\VSC-SE-master\SpaceEngineers\SpaceEngineers.csproj
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
info: OmniSharp.WorkspaceInitializer
Configuration finished.
info: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location 'd:\Users\SnowSky\Projekte\VSC-SE-master' on host 14204.
[warn]: OmniSharp.MSBuild.ProjectLoader
There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "Sandbox.Common", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
[warn]: OmniSharp.MSBuild.ProjectLoader
There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "Sandbox.Game, processorArchitecture=AMD64", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
[warn]: OmniSharp.MSBuild.ProjectLoader
There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "SpaceEngineers, processorArchitecture=AMD64", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
[warn]: OmniSharp.MSBuild.ProjectLoader
There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "SpaceEngineers.Game, processorArchitecture=AMD64", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
[warn]: OmniSharp.MSBuild.ProjectLoader
There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "SpaceEngineers.ObjectBuilders, processorArchitecture=AMD64", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
[warn]: OmniSharp.MSBuild.ProjectLoader
There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "VRage.Game, processorArchitecture=AMD64", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
info: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'd:\Users\SnowSky\Projekte\VSC-SE-master\SpaceEngineers\SpaceEngineers.csproj'.
d:\Users\SnowSky\Projekte\VSC-SE-master\SpaceEngineers\SpaceEngineers.csproj
c:\Users\SnowSky.vscode\extensions\ms-dotnettools.csharp-1.23.8.omnisharp\1.37.5.msbuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): Error: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "Sandbox.Common", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
c:\Users\SnowSky.vscode\extensions\ms-dotnettools.csharp-1.23.8.omnisharp\1.37.5.msbuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): Error: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "Sandbox.Game, processorArchitecture=AMD64", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
c:\Users\SnowSky.vscode\extensions\ms-dotnettools.csharp-1.23.8.omnisharp\1.37.5.msbuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): Error: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "SpaceEngineers, processorArchitecture=AMD64", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
c:\Users\SnowSky.vscode\extensions\ms-dotnettools.csharp-1.23.8.omnisharp\1.37.5.msbuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): Error: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "SpaceEngineers.Game, processorArchitecture=AMD64", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
c:\Users\SnowSky.vscode\extensions\ms-dotnettools.csharp-1.23.8.omnisharp\1.37.5.msbuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): Error: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "SpaceEngineers.ObjectBuilders, processorArchitecture=AMD64", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.
c:\Users\SnowSky.vscode\extensions\ms-dotnettools.csharp-1.23.8.omnisharp\1.37.5.msbuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(2123,5): Error: There was a mismatch between the processor architecture of the project being built "MSIL" and the processor architecture of the reference "VRage.Game, processorArchitecture=AMD64", "AMD64". This mismatch may cause runtime failures. Please consider changing the targeted processor architecture of your project through the Configuration Manager so as to align the processor architectures between your project and references, or take a dependency on references with a processor architecture that matches the targeted processor architecture of your project.

Adding project 'd:\Users\SnowSky\Projekte\VSC-SE-master\SpaceEngineers\SpaceEngineers.csproj'
info: OmniSharp.MSBuild.ProjectManager
Update project: SpaceEngineers
info: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionService
Could not find document for file d:\Users\SnowSky\Projekte\VSC-SE-master\SpaceEngineers\rocket_test.cs
info: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionService
Could not find document for file d:\Users\SnowSky\Projekte\VSC-SE-master\SpaceEngineers\rocket_test.cs
`

@gregretkowski
Copy link
Owner

Sorry, I havent done any SE coding since 2018. if you figure it out let me know!

@chrisui
Copy link

chrisui commented Jan 29, 2021

@ArcticSnowSky Don't suppose you had any luck with this one? I'm encountering the same thing and sadly not very experienced with .NET tooling.

@ArcticSnowSky
Copy link
Author

Hi, I'm sorry, I was trying a bit around but after some time I lost my attention due to christmas etc and did not return yet for gaming due to work.
However I'd be still interested!

@reksar
Copy link

reksar commented Mar 31, 2021

@ArcticSnowSky Try this solution
If it helps, I could think about pull request.

@ArcticSnowSky
Copy link
Author

@reksar Hi and thank you for the notification!
I tried your project and I'm happy like a child on x-mas seeing Intellisense working :).
I will go on with some tests combined with ingame - definitely a good start!

@reksar
Copy link

reksar commented Apr 2, 2021

@ArcticSnowSky Glad to be helpful. You can combine export.bat with terminal tasks in VS Code and update your script in-game instead of copy/paste ;)

@ArcticSnowSky
Copy link
Author

ArcticSnowSky commented Apr 2, 2021

@reksar jeah at the moment I'm trying get a single key shortcut on my task so that I don't have to press so many times Ctrl+shift+b -> Enter :D.
My Task looks like this:

# task.json
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "export",
            "type": "shell",
            "command": "scripts\\export.bat",
            "args": [
                "..\\${relativeFileDirname}"
            ],
            "group": "build",
            "problemMatcher": []
        }
    ]
}

So finally I removed the task and created a launch.json, this way I simply press F5 and it gets exported.

# launch.json
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Export",
            "type": "clr",
            "request": "launch",
            "program": "${workspaceFolder}\\scripts\\export.bat",
            "args": "..\\${relativeFileDirname}",
        }
    ]
}

Additionally I added on line 18 of export.bat

# export.bat

SET script_dir=%script_dir:..\scripts\=%

@ArcticSnowSky
Copy link
Author

@ArcticSnowSky Glad to be helpful. You can combine export.bat with terminal tasks in VS Code and update your script in-game instead of copy/paste ;)

The export works, however I don't know how to update the programmable block ingame in a fast manner; do I have to do every time the following mouse clicks (don't know the exact translation)?

  • click "modify" to enter the code editor
  • click "search for scripts"
  • doubleclick the script
  • click ok
  • compile
  • execute

Is there a faster way that I don't know?

Your solution works great, it feels clean and simple to adapt! Just great!

When I started to create a programmated rocket launcher for a satellite with remote antenna status updates and command functions, the code became to complex to write it in the ingame editor - also I didn't want to have the game open and the fans running loud for several hours, when I was solely writing code the whole time.
Without a good Code Editor I didn't want to spend any more time - now I'm back in game 👍

@reksar
Copy link

reksar commented Apr 4, 2021

@ArcticSnowSky Thank you for the feedback. Thanks to it I made automated export during saving the Script.cs with Ctrl+S (look at the current version).

Simple steps from here does not works for me :( Probably, the problem is in SDK environment settings, so I decided to avoid the SDK by adding the task and key binding.

These steps are painful for me too. After you asked about it, I am thinking it over now.

  • click "modify" to enter the code editor
  • click "search for scripts"
  • doubleclick the script
  • click ok
  • compile
  • execute

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

No branches or pull requests

4 participants