sharpSteff / lapce-csharp-plugin

Apache License 2.0
7 stars 0 forks source link

Powershell/csx support? #1

Open MostHated opened 1 year ago

MostHated commented 1 year ago

Hey there, Are there any plans to support PowerShell Core for Linux?

Also, I know this is a long shot, but how about dotnet-script (.csx files)? Unfortunately, I have been asking Jetbrains for support in Rider for it for years, but no movement.

Vscode supports it, but... then I would have to use VSCode, which is nearly not worth it.

Thanks, -MH

sharpSteff commented 1 year ago

I utilize OmniSharp, so csx files should work.

https://github.com/OmniSharp/omnisharp-roslyn/wiki/Configuration-Options

You have to create a omnisharp.json file and place it in your workspace and add following lines (with your custom settings).

{ "script": { "enabled": true, "defaultTargetFramework": "net6.0", "enableScriptNuGetReferences": true } }

powershell core is a seperate issue I have to look into.

sharpSteff commented 1 year ago

I published v.1.1.0 with css support. Make sure you restart Lapce after install.

image

I added a omnisharp.json file to the workspace with:

{
  "script": {
    "enabled": true,
    "enableScriptNuGetReferences": true,
    "defaultTargetFramework": "net6.0"
  }
}

surely you can use a different TargetFramework.

MostHated commented 1 year ago

This is great news, thank you for this!

sharpSteff commented 1 year ago

I don't know if it's only on my machine, but I receive random Omnisharp crashes when working with .csx https://github.com/OmniSharp/omnisharp-roslyn/issues/2500

Maybe you can try it out maybe even add some logs to the ticket

MostHated commented 1 year ago

Sure thing. I have a few meetings this morning but will see if I can fit in a few minutes to at least give it a try. Then this afternoon, I can definitely give it a thorough go. :+1:

MostHated commented 1 year ago

This is a repo I often reference, as it covers many use-cases, just in case it is useful in narrowing down/pinpointing an issue. https://github.com/cesarrrguez/CSharpScripts

I also make use of .rsp files and .slnf in one of my projects, which acts as a dotnet-based version of the now deprecated "jobber", or "ofelia" applications. I will see if I have any issues with this project, as it pretty much makes use of all possible .csx features.

This is what my typical omnisharp.json contained:

Details ```jsonc { "script": { "enabled": true, // I just added this, had not used it prior. "enableScriptNuGetReferences": true, "defaultTargetFramework": "net7.0", "rspFilePath": "./resources.rsp" }, "fileOptions": { "userExcludeSearchPatterns": [ "dotnet/csharp/**", "dotnet/nsh/**", "dotnet/ha/**", "**/.history/", "**/.lh/" ] }, "FormattingOptions": { "EnableEditorConfigSupport": false }, "RoslynExtensionsOptions": { "documentAnalysisTimeoutMs": 1000, "enableDecompilationSupport": true, "enableImportCompletion": true, "enableAnalyzersSupport": false } } ```

Edit: I am still relatively new to lapce, but from the looks of it, I am not seeing any errors in the bottom left, or should I be looking elsewhere for them? You can see the comparison to VSCode though. Strangely, the lapse highlighting seems to be sporadic? I made sure I was on v.1.10.0 as specified, then closed and reopened the editor.

Screenshot ![](https://img.instance.id/cDQ5iOunLaxC/direct)
sharpSteff commented 1 year ago

I can confirm csx has some highlighting issues. Maybe open an issue at https://github.com/lapce/lapce/issues

MostHated commented 1 year ago

Ok, certainly can do. My apologies, sometimes hard to know exactly what falls under a plugin-related issue, or a lapce issue.

sharpSteff commented 1 year ago

@MostHated I opened a issue at razzmatazz/csharp-language-server/issues/81