oleg-shilo / cs-script.vscode Goto Github PK
View Code? Open in Web Editor NEWVSCode extension for CS-Script
License: MIT License
VSCode extension for CS-Script
License: MIT License
About two weeks ago, "C# for Visual Studio" was updated. Since then, I get the following error when loading a csharp file:
CS-Script: CS-Script: The required extension "C# for Visual Studio Code" is not found. Ensure it is installed.
The extension is installed. I tried uninstalling and reinstalling the C# extension, CS-Script, and VS Code itself with no luck.
I followed the directions with no luck.
I open my file...no intellisense.
CS-Script run script fails with this simple script:
using System.IO;
System.Console.WriteLine(File.Exists(""));
[Running] dotnet "C:\Users\JanMechtel\AppData\Roaming\Code\User\cs-script.user\dotnet\cscs.dll" "c:\Users\JanMechtel\new_script.cs"
Error: Specified file could not be executed.Could not load type 'System.IO.File' from assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
[Done] exited with code=0 in 4.53 seconds
CS-Script run script after CS-Script: New C# script work fine.
I feel like it's releated to the .net version but I couldn't figure it out.
If I run the same script with css.exe it works fine.
Giving a lot of errors in the log file when trying to install the extension
Steps to reproduce:
-- Install the VS Code extension at Visual Studio Marketplace
Intellisense is not working for me, since no suggestion appears to autocomplete when putting something, I have tried what has occurred to me and I have read but it still does not work.
VSCode v1.44.1 (system setup)
VSCode Extension v1.6.4
CS-Script Engine v3.29.0
I use scriptcs because it allows to write scripts without basic using, main class and main static method.
The following code works without using, class or method:
Console.WriteLine("Hello");
As I like very much you extension, because it allows to code and debug in vscode, I would like also to use scriptcs with your extension.
Do you think there is any way to replace the call of cscs
by scriptcs
? And do you think the debugging feature still work?
mono C:\ProgramData\chocolatey\bin\scriptcs.exe .\script.cs
When I click "Load Project" on a CS-Script file, all I get is a new workspace with launch.json and tasks.json. Interestingly, if I go into the command pallete and click load project again it brings up the file I had open. However the file is still not open from within the workspace and thus OmniSharp is not being ran on the file.
it isn't doing anything else it just throws that error at me
i'm on macOS and have tried restarting my computer
Based on #7:
Can you add an option to turn this (formatting) off? I use "C# FixFormat" to format, since it has some extra options I like. Having them both active messes up formatting of C# files.
Also, it seems like the CSS formatter is removing indentation on blank lines?
seems related to recent commit "- Added tunneling StartDebug
request when workspace is loaded"
Now, trying ctrl+F5 just launches the .NET Core debugger and not Mono cs-script debugger anymore.
If I run the script with no .vscode folder, it prompts to create one & still wont start a mono based csscript debugger.
Folder named "Sähkö" gets ignored and CS-script generates a new folder called "S�hk�".
A sample syntax (with incomplete directive) to trigger the error:
//css_ref
using System;
public class Program
...
In the command console when I use the cscs command to execute some C# script, it appears to me that there is incompatibility with the "$" sign for string concatenation (this function was set in the C # 6 version), but when occupying the "CS-Script: Run in Terminal" button does work and there are no problems, so I don't know why I usually use the command console instead of the button.
Thank you for your attention, I hope you are well.
Error: Specified file could not be compiled.
csscript.CompilerException: c:\Users\Luck\Projects\Demo\Program.cs(10,31): error CS1056: Unexpected character '$'
at csscript.CSExecutor.ProcessCompilingResult(CompilerResults results, CompilerParameters compilerParams, ScriptParser parser, String scriptFileName,
String assemblyFileName, String[] additionalDependencies)
at csscript.CSExecutor.Compile(String scriptFileName)
at csscript.CSExecutor.ExecuteImpl()
VSCode v1.44.2 (system setup)
VSCode Extension v1.6.4
CS-Script Engine v3.29.0
.NET Core v3.1.2
Hi, Oleg.
I work with CS-Script in a hosted environment. I find it very usefult to check the scripts syntax beforehand. Otherwise, an exception will be thrown in time of execution.
But VSCode extension always shows 2 errors: the program does not contain any 'Main' static method as entrypoint (translated from spanish). Is there any means to 'inform' the extension: this is not a program, but a single script?
Updates after 1.4.0 have affected the searchDirs parameter in Engine Settings. This parameter does not seem to be working in later releases. Direct references to the directories and objects need to be put in to bypass the issue.
In explorer I associated the *.csx
files to %APPDATA%\Code\User\cs-script.user\cscs.exe
But when I double-click on a *.csx
file a console is displayed but disappears immediately.
Do you know how could I obtain the following behavior: double-click on a *.csx
file opens a console, executes my cs script in it (allowing input read) and stays alive if I put a Console.ReadKey()
in my cs script?
OS version : Windows 10
Hi, First of all thank you for the plugin.
If mono is not installed it's not possible to use the plugin .
I have this error
CS-Script: Error: Command failed: mono --version 'mono' is not recognized as an internal or external command, operable program or batch file.
Cheers.
Ported from oleg-shilo/cs-script#165
I am using VS Code in portable mode, which places all user files and extensions under the the "VS Code Folder"/Data. Cs-Script does not recognize the portable installation and still installs updates under "User Folder"/AppData/Code/User. Is this an issue with VS Code or Cs-Script? Thanks in advance.
.END.
Something wrong with GitHub issues, pasting pictures fails to display some the pictures, instead
it displays the link only (preview and after posting) weird.
It takes several attempts then sometime it requires drag and drop .
I installed on Windows 10 Enterprise.
I installed the latest version of VS Code (1.41.1).
I installed CS-Script (v3.29.0) via chocolaty.
I installed Mono 6.8
I installed latest extension versions of "ms-vscode.mono-debug" (v0.15.8) and "ms-vscode.csharp" (v1.21.9) and "oleg-shilo.cs-script" (v1.5.10).
No I wrote a very simple script (see attachment, extension has to be renamed to *.cs)
Test.txt
And tried to debug with Alt+F5. the Debug console shows:
mono --debug --debugger-agent=transport=dt_socket,server=y,address=127.0.0.1:33949 cscs.exe -d -inmem:0 -co:/debug:pdbonly -ac:2 c:\Temp\TestScripts\Test.cs
And after a few seconds (I translated it from german to english):
The command ""c:\Temp\TestScripts\mono.exe"" is either misspelled or
could not be found.
My path environment variable is pointing to the right directories:
PATH=C:\Program Files\Mono\bin;C:\ProgramData\chocolatey\lib\cs-script\tools\cs-script\lib;C:\ProgramData\chocolatey\lib\cs-script\tools\cs-script
What is wrong?
Trying to use VSCode for csscript, but any command (debug, run, compile) outputs "Der Befehl "mono" ist entweder falsch geschrieben oder konnte nicht gefunden werden." (german, means "Command 'mono' is either wrong typed or cannot be found." / "Bad command or file name").
Any suggestion what can be wrong?
Using latest cs-script with latest VSCode (1.12.2) on german windows 7.
Are you planning on releasing a cs-script.core.vscode?
I already have dotnet core on my machine, installing mono for cs-script.vscode feels like overkill ;-)
No sure if I'm missing it or if it's not there....if not...it would be nice :)
Moved from of oleg-shilo/cs-script#191 (@mmickael)
Hi Oleg, after upgrading VS Code to 1.44.0, Cs-Script seems to have a problem with initialization and the extension stops working. Please see the lower left corner of the attached screenshot.
Cs-Script version 1.6.0-2 (8 Apr, 2020)
Does this extension support .Net Framework 4.8? If so, what are the steps to do so?
osx version 10.13.5
mono version 5.12.0
[Running] mono "/Users/wind/Library/Application Support/Code/User/cs-script.user/cscs.exe" "/Users/wind/Documents/test/Untitled-1.cs"
Error: Specified file could not be compiled.
System.InvalidOperationException: No process is associated with this object.
at System.Diagnostics.Process.EnsureState (System.Diagnostics.Process+State state) [0x00018] in <81ba78c8dc794b7f9f7b530c53db0f84>:0
at System.Diagnostics.Process.get_HasExited () [0x0000b] in <81ba78c8dc794b7f9f7b530c53db0f84>:0
at System.Diagnostics.Process.EnsureState (System.Diagnostics.Process+State state) [0x0007b] in <81ba78c8dc794b7f9f7b530c53db0f84>:0
at System.Diagnostics.Process.get_ExitCode () [0x00000] in <81ba78c8dc794b7f9f7b530c53db0f84>:0
at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.get_ExitCode()
at Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler+MonoExecutor_patched.Local_InternalExecWaitWithCapture (System.String file, System.String cmd, System.String currentDir, System.CodeDom.Compiler.TempFileCollection tempFiles, System.String& outputName, System.String& errorName) [0x0011f] in <864b15734bd0484490a76fff76589a6c>:0
at Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.Compile (System.CodeDom.Compiler.CompilerParameters options, System.String compilerFullPath, System.String arguments, System.String& outputFile, System.Int32& nativeReturnValue) [0x000e1] in <864b15734bd0484490a76fff76589a6c>:0
at Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.FromFileBatch (System.CodeDom.Compiler.CompilerParameters options, System.String[] fileNames) [0x001b8] in <864b15734bd0484490a76fff76589a6c>:0
at Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.CompileAssemblyFromFileBatch (System.CodeDom.Compiler.CompilerParameters options, System.String[] fileNames) [0x0005d] in <864b15734bd0484490a76fff76589a6c>:0
at csscript.CSExecutor.CompileAssembly (System.CodeDom.Compiler.ICodeCompiler compiler, System.CodeDom.Compiler.CompilerParameters compilerParams, System.String[] filesToCompile) [0x00000] in <8c9ac531470d4f7d8dc846a682dcb1ef>:0
at csscript.CSExecutor.Compile (System.String scriptFileName) [0x007d8] in <8c9ac531470d4f7d8dc846a682dcb1ef>:0
at csscript.CSExecutor.ExecuteImpl () [0x005a1] in <8c9ac531470d4f7d8dc846a682dcb1ef>:0
[Done] exited with code=1 in 0.445 seconds
hi oleg-shilo
the features i really miss in VSCode is Autocompletion & Format document
OmniSharp doesn't work for me
Dependencies are instaled but the extension doesn't work.
mono : The term 'mono' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1
+ CategoryInfo : ObjectNotFound: (mono:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
It looks like intellisense in VS Code does not work for packages imported using //css_nuget
directive.
For example with //css_nuget Newtonsoft.Json;
, the intellisense does not work for types from this nuget.
I see it's referenced in the "CS-Script - Active" pane and the general C# intellisense from Omnisharp works OK.
Or maybe I have some configuration issues?
VS Code version:
Version: 1.61.0 (system setup) Commit: ee8c7def80afc00dd6e593ef12f37756d8f504ea Date: 2021-10-07T18:11:57.396Z Electron: 13.5.1 Chrome: 91.0.4472.164 Node.js: 14.16.0 V8: 9.1.269.39-electron.0 OS: Windows_NT ia32 10.0.19042
CS-Script version:
CS-Script.VSCode - v2.0.1 ------------------------------------------------------- C# Script execution engine (.NET Core). Version 4.1.0.0. Copyright (C) 2004-2020 Oleg Shilo. www.csscript.net (github.com/oleg-shilo/cs-script.core) CLR: 5.0.10 System: Microsoft Windows NT 10.0.19042.0 Architecture: x64 Install dir: Script engine: C:\Users\admin\AppData\Roaming\Code\User\cs-script.user\dotnet\cscs.dll Config file: Compiler engine: dotnet (C:\Program Files\dotnet\dotnet.exe) NuGet manager: dotnet NuGet cache: C:\Users\admin\.nuget\packages Custom commands: C:\ProgramData\cs-script\commands Global includes: C:\ProgramData\cs-script\inc ------------------------------------------------------- Syntaxer C:\Users\admin\AppData\Roaming\Code\User\cs-script.user\dotnet\syntaxer\syntaxer.dll Extension c:\Users\admin\.vscode\extensions\oleg-shilo.cs-script-2.0.1\out
...it's not enough for mono to be installed. It needs to be in the path or cs-script.vscode cannot find it. It would be nice for new users to add this to the documentation.
I see this has been fixed in the main engine (oleg-shilo/cs-script#189) but I am still seeing this bug on the VS Code extension.
In my code that I am editing in VS Code, when I save with the line:
"//css_ref C:\Program Files ((x86))\Microsoft Office\Root\Office16\EXCEL.EXE"
the CS-Script pane in the Explorer shows no references.
When I delete the line and save, references appear.
Is a cosmetic problem that does not affect functionality.
Caused by overly aggressive handling the race condition between "refresh_project_tree" triggered by saving the script document and the script already being executed.
The race condition is handled correctly but the message should not be shown in this case as tree refreshing is truly secondary with respect to the script execution.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.