Visual Studio Code IDE | Cucumber | Any possible way to navigate to Step definition file from the feature file (like in Ruby Mine IDE)? - visual-studio-code

I have been a RubyMine IDE and now I am trying to use VS Code IDE. I want to navigate from the feature file to the step definition. I tried multiple extensions like Cucumber (Gherkin) Full Support, etc but none of them work properly. I always get redirected to one of the step definition files (as if it is set as a default step definition) if I click on any of the steps from the feature file. How to deal with this? Any other extension which is recommended to use?
Thank you.

I think your .vscode\settings.json is not good...
My setup:
In VSCode, add "Cucumber (Gherkin) Full Support - Alexander Krechik"
Note, in my case, doN'T install "Cucumber - Cucumber"!
CMD/PowerShell:
md newfolder
cd newfolder
dotnet new -i specflow.templates.dotnet
dotnet new specflowproject --help
dotnet new specflowproject -f net5.0 -t nunit
Now the actual solution...
Create .vscode\settings.json, some thing like:
{
"cucumberautocomplete.steps": [
"/**/Steps/**/*.cs"
]
}
F12 and Ctrl+mouse click should to work well.

Related

How to open a file in vscode from browser?

I want my webapp to be able to open a given file in VS code. For example, when I click a button on my webapp, a file say, C:\Users\...\myProject\index.html is opened, if myProject is already opened it should navigate to index.html
I know its a peculiar use case but I want to know if its possible in vscode.
Its also completely fine if it requires using browser or vscode extension.
vscode://file/{full path to project}/
Thanks to fbg13 for providing this link
It is possible if you are using Firefox:
Open the about:config page.
Set the view_source.editor.external to true.
Set the view_source.editor.path to the VSCode's executable absolute path.
It is possible if you add this link:
vscode://file/{fullpath}:{numrow}
Example for Symfony 5.3 and higher
For example in Symfony to use the link that appears in the debug bar of the controller used you can do it as described in the examples. You have to edit your project config.
Only for VS Code:
config\packages\framework.yaml
framework:
ide: 'vscode://file/%%f:%%l'
For any editor through env:
config\packages\framework.yaml
framework:
ide: '%env(resolve:CODE_EDITOR)%'
And don't forget to add value for CODE_EDITOR into .env or .env.local.
Local
This is an example for local projects.
.env or .env.local:
CODE_EDITOR=vscode
# or
CODE_EDITOR=vscode://file/%%f:%%l
Docker
If you use Docker or trying to open a file from remote server, you may use this example.
.env or .env.local:
# Template
CODE_EDITOR=vscode://file/%%f:%%l&/PATH/TO/YOUR/SERVER/APP>/PATH/TO/YOUR/LOCAL/APP
# Real paths
CODE_EDITOR=vscode://file/%%f:%%l&/app/>/home/user/projects/symfony_project/
For more details see these pages:
Symfony Framework Configuration Reference - ide
Opening VS Code with URLs
You can install vscode-handler to open files like this
vscode://open?url=file://%file&line=%line

Start a new project in VSCode [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed last year.
The community reviewed whether to reopen this question 11 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
There's a few things I'm having trouble with here that are related:
I'm trying to start a new project, but it keeps defaulting to the one I have open already. I can't seem to find a way to start fresh with a new project.
I can't figure out how to remove folders from the project. Say I added the wrong folder to my project and I want to remove it, how would I do this?
Thanks
File->New Window seems to do the trick
The projects are filesystem based. So if it's in your folder structure it'll be shown in VSCode; I believe this is by design. The only way to remove the folder would be to do so from the FS level.
Create a new Folder
Use VS Code to Open that empty folder.
Open the Integrated Terminal by selecting View\Terminal
In the terminal window, type dotnet new console.
This command creates a Program.cs file in your folder with a simple "Hello World" program already written, along with a C# project file named HelloWorld.csproj
VSCode works primarily with folders.
If it discovers a .sln, project.json or global.json file in the folder you open, it will load them and allow you to switch between them.
The explorer will always show the filesystem, regardless of what project is currently loaded.
Also, on startup, VSCode will automatically open the last opened folder.
Pressing shortcut
Ctrl + Shift + N
opens a new Window, which gives you the possibility to open a new folder.
On macOS it's
Cmd + Shift + N
OPen the terminal window In the terminal window, type
dotnet new console
. to start with new console application.
To Create ASP .net web API project
dotnet new webapi -n MyWebAPI
For any help
dotnet new --help
To build the project, In terminal type
dotnet build
To run the project, In terminal type
dotnet run
Answered here - Create C# .sln file with Visual Studio Code
Open VS Code terminal and navigate to the directory where you want to create solution folder.
Use following commands
dotnet new sln -o MyApiApp
The -o parameter lets you specify the output directory
Navigate to solution direction
Cd .\MyApiApp\
Create new projects under root solution folder
dotnet new console -o MyApiApp.ConsoleApp
dotnet new webapi -o MyApiApp.WebApi
dotnet new classlib -o MyApiApp.Repository
dotnet new xunit -o MyApiApp.Tests
Add projects to solution (use tab to navigate path).
dotnet sln MyApiApp.sln add .\MyApiApp.ConsoleApp\MyApiApp.ConsoleApp.csproj .\MyApiApp.WebApi\MyApiApp.WebApi.csproj .\MyApiApp.Repository\MyApiApp.Repository.csproj .\MyApiApp.Tests\MyApiApp.Tests.csproj
Add project references
dotnet add .\MyApiApp.WebApi\MyApiApp.WebApi.csproj reference .\MyApiApp.Repository\MyApiApp.Repository.csproj
dotnet add .\MyApiApp.ConsoleApp\MyApiApp.ConsoleApp.csproj reference .\MyApiApp.Repository\MyApiApp.Repository.csproj
dotnet add .\MyApiApp.Tests\MyApiApp.Tests.csproj reference .\MyApiApp.WebApi\MyApiApp.WebApi.csproj .\MyApiApp.Repository\MyApiApp.Repository.csproj
I like to open it via run command: code path . Make sure you have VS Code installation path added in your environment variable PATH.
VS Code doesn't include a traditional File > New Project dialog or pre-installed project templates. You'll need to add additional components and scaffolders depending on your development interests. With scaffolding tools like Yeoman and the multitude of modules available through the npm package manager, you're sure to find appropriate templates and tools to create your projects.
Right click the workspace and click add folder to workspace. Then add the folder you want to use.

Extension not found error with control flow extension

I am trying to use https://github.com/qiemem/ControlFlowExtension as an alternative to if-else.
I have it to added to the extensions folder(C:\Program Files (x86)\NetLogo 5.1.0\extensions). The extracted zipped folder from github.
In the NetLogo code I use the following,
extensions[ControlFlowExtension-master]
But it still shows me the following error:
There is no release for the extension yet. The zip file that you downloaded is just the source code and doesn't contain the compiled JAR files that you need to use the extension with NetLogo.
If you want to try it out, you will have to build it yourself. For that, you will need to install sbt. Then, open a command terminal and cd to the folder where you unzipped the file you downloaded from GitHub. This folder should be under the NetLogo extensions folder and be called cf (rename it if it is not the case). Once you are in the cf folder, run:
sbt package
This should build cf.jar and allow you to use the extension by putting
extensions [ cf ]
at the top of the code tab in your NetLogo model.
Be aware, though, that the extension is still very much experimental. There may be bugs. The syntax could still change. This is why Bryan did not put out an official release yet.

How to configure SublimeREPL for mit-scheme?

I have installed SublimeREPL, and now I am trying to customize the interpreters a bit. How can I add MIT Scheme to the Tools->SublimeREPL menu? I am new to Sublime Text 2.
You can read documentation about configuring additional REPLs here:http://sublimerepl.readthedocs.org/en/latest/#basics-of-language-integration-configuration-and-launch-commands
And take a look at existing Scheme configuration here:
https://github.com/wuub/SublimeREPL/tree/master/config/Scheme
Most Scheme/Lisp dialects are quite easy to configure, you should have no problems whatsoever.
Please allow me to share my experience. Just made it work on my machine.
First, recommend you to install a SCM implementation of Scheme, which is much easier to config than mit-scheme.
If you use windows, the env variable should be added to the system
automatically after you finished installation.
Then, open Preferences -> Browse Packages -> SublimeREPL -> config -> Scheme -> Main.sublime-menu.
At last, config this file like this:
Now it should work. Enjoy it!
After trying for a good 2 hours, I finally figured out how to get it working in SublimeText 3.
First install the package "Scheme" through package control.
Then install the package "SublimeREPL" (for Sublime Text 2/3).
Then install SCM implementation of scheme as #mons mentioned.
Once Done, modify the file shown below.
SublimeText3 >> InstalledPackages >> Scheme.sublime-package (open with Zip software) >> Scheme.sublime-build (modify to the following below)
{
"cmd": ["scm", "-f", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.scheme"
}
I realised that my "Scheme" installed through Package Installer was overriding my Sublime Build Settings in the SublimeREPL folder. That's why it didnt work eventhough I modified my settings as #mons mentioned.
Thats it.
Hope it works. :)

ST2 Mocha CoffeeScript symbols

Anyone know if there's a way to browse Mocha tests (in CoffeeScript)via Sublime Text 2 symbols list? Ideally there'd be a plugin, but I'd be fine with editing my CoffeeScript plugin to look for describe and it. I don't know how the whole tmLanguage thing works, could someone show me how to do it or let me know the code to add.
It'd be super rad to navigate my testes using ST2 symbols list!
Thanks!
Although CoffeeScript has a good coloring support in ST2, it's pretty bad in Go To Symbol panel.
I've created a fork of original plugin, where (along with some other cosmetic changes) it shows all classes and functions defined in a file, as well as some known method invocation such as 'describe', 'it' for Mocha and 'app.get', 'app.post', etc for Express.
Currenly it looks like this:
You can see the changes diff on GitHub.
To install it, either download the package and unzip its contents to your Packages/CoffeeScript directory, or git clone it (dont forget to close ST2 beforehand):
cd <user directory>/Packages
rm -r CoffeeScript
git clone -b correct-goto-symbols git://github.com/ashtuchkin/CoffeeScript-Sublime-Plugin.git CoffeeScript
I've also added it as a pull request to the original plugin author, so lets hope it will be in standard package soon.