dotnet / dotnet/vscode-csharp

Add support for C# script return types

Open
#7,720 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3.1k
Forks
737
Avg merge
17h 56m
Merged PRs (30d)
21

Description

We use VS Code as the editor for C# scripts. These scripts are compiled using `CSharpCompilation.CreateScriptCompilation()` and can therefore have a return type. In our case this is a JObject, but this can change in the future.

We generate a .csproj file next to each script to get intellisense working. Using C#'s top level statements and implicit usings we achieve this for 99%! The only thing that currently is missing is that there is no way to declare the expected return type. VS Code will expect a void or an integer, and therefore mark each return JObject as an error.

I've searched for hooks to pass this along inside this codebase but fear that there is no easy solution.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.