gregretkowski / VSC-SE

Visual Studio Code setup for Space Engineers script development
45 stars 16 forks source link

Did the steps change meanwhile? IntelliSense problem #1

Open ArcticSnowSky opened 3 years ago

ArcticSnowSky commented 3 years ago

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)
    DotNetPath set to dotnet
    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"
    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'
    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
    Detecting Cake files in 'd:\Users\SnowSky\Projekte\VSC-SE-master'.
    Could not find any Cake files
    Detecting projects in 'd:\Users\SnowSky\Projekte\VSC-SE-master\SpaceEngineers.sln'.
    Queue project update for 'd:\Users\SnowSky\Projekte\VSC-SE-master\SpaceEngineers\SpaceEngineers.csproj'
    Detecting CSX files in 'd:\Users\SnowSky\Projekte\VSC-SE-master'.
    Could not find any CSX files
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
    Loading project: d:\Users\SnowSky\Projekte\VSC-SE-master\SpaceEngineers\SpaceEngineers.csproj
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
    Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
    Configuration finished.
    Omnisharp server running using Stdio at location 'd:\Users\SnowSky\Projekte\VSC-SE-master' on host 14204.
    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.
    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.
    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.
    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.
    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.
    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.
    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'
    Update project: SpaceEngineers
    Could not find document for file d:\Users\SnowSky\Projekte\VSC-SE-master\SpaceEngineers\rocket_test.cs
    Could not find document for file d:\Users\SnowSky\Projekte\VSC-SE-master\SpaceEngineers\rocket_test.cs

`

gregretkowski commented 3 years ago

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

chrisui commented 3 years ago

@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 commented 3 years ago

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 commented 3 years ago

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

ArcticSnowSky commented 3 years ago

@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 commented 3 years ago

@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 commented 3 years ago

@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 commented 3 years ago

@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)?

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 commented 3 years ago

@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