Configuring Hy to run on VSCode - visual-studio-code

I'm trying to debug Hy code in Visual Studio Code. I have downloaded the hy-mode theme and it works great. There's only one problem. The hy-mode theme disables breakpoints.
I can add a breakpoint to my Hy code by switching to a totally unrelated language (like CoffeeScript) and then my Python debugger works. But I can't add breakpoints when I'm in hy-mode.
I debug code by writing a Python file that imports a Hy file. When I run the Python pdb debugger on the Python file, pdb debugs the Hy code just fine. But I can't add breakpoints to the Hy file when I'm have hy-mode active.
Is there a way to edit a Visual Studio Code theme so that to allow the insertion of breakpoints?

I found a solution to this problem. By adding "hy" to the languageIds list in the following files I can get Hy files to display breakpoints.
./ms-python.python-2019.8.30787/package.json
ms-python.python-2019.8.30787/out/client/package.json
"debuggers": [
{
"type": "python",
"label": "Python",
"languages": [
"python"
],
"enableBreakpointsFor": {
"languageIds": [
"python",
"html",
"jinja",
"hy"
]
},

Related

Why does vscode-eslint use a different "root" than ESLint?

Everytime I open my project folder in Visual Studio Code, I get an error on the first line of each file. It cannot find my tsconfig.json file because it is looking in the directory I opened VS Code, not where my eslint.json is. I have a functions folder in my root project where the ESLint config is.
Here is part of it:
"parserOptions": {
"ecmaVersion": 2019,
"project": ["./tsconfig.json", "./tsconfig.dev.json"],
"sourceType": "module"
},
When I run my lint command eslint "src/*.{ts,js}", it works perfectly and shows the correct warnings. This means that the VS Code plugin dbaeumer.vscode-eslint parses the .eslintrc.json config differently than what it should.
If I change the project to ["./functions/tsconfig.json", "./functions/tsconfig.dev.json"], then VS Code stops giving the error, but when I run ESLint, it tries to find it in <path/to/project>/functions/functions/tsconfig.json going in the functions directory twice.
Is this a VS Code bug, a dbaeumer.vscode-eslint bug, or am I doing something wrong? What can I do to fix the error?
You can just add this "eslint.workingDirectories": [{ "mode": "auto" }] to your VS Code settings.json.
It should make the error go away, but it can have unintended side effects.
More Info: https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint#settings-options

Visual Studio Code SASS compiler

I switch from Sublime to VS Code because it anymore PHP and SASS support. I mostly use CSS & SASS & JS & PHP.
I set up a SASS compiler from VS Code documentation. As follows:
// Sass configuration
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "Sass Compile",
"type": "shell",
"command": "node-sass style.scss style.css",
"group": "build",
"problemMatcher": [
"$eslint-compact"
]
}
]
}
I tested it working properly. But I have 2 problems:
First of all, it focuses on "style.scss" file. I mean, whatever we mentioned in ".json".
Actually what I want is: Focus on all ".scss" files without searching for a name.
When I run an compile with the "a.scss" editor open, it compiles only names in the ".json" file. But there not contain "a.scss"!
Actually what I want is: If I press the "CTRL + SHIFT + B" key and select the corresponding option, the currently active editor is the "a.scss" compilation.
Are there any settings for these?
Note: "command": "node-sass .scss .css", it will give error.
Actual the situation is, that SASS actualized to a new version Dart SASS. There are new rules like #use in it ... so the used compilers needs to be updated.
As I know up to now Node Sass did not.
The better way to use SASS in VS Code is to use an extension.
As we had this several times:
If you are interessted in it you may look here https://stackoverflow.com/a/66207572/9268485
Note: if you decide to use one of the extensions your settings may change. Have a look to the extensions descriptions.

java.lang.ClassNotFoundException: Cannot find implementation for MyMapper in Visual studio code

Class not found exception in Visual studio code because vs-code debug takes output class files form bin directory like eclipse but i am using GRADLE for build so MapperImpl.java which is implementation files in mapper are created in the build folder i don't know how to solve the issue i tried to change the classpath all the solutions i tried but nothing working please i need your help
I am also posting the vs code file launch.json
{
"type": "java",
"name": "Debug (Launch)-Application<RestApi>",
"request": "launch",
"mainClass": "ae.org.nge.Application",
"projectName": "RestApi",
"vmArgs": "-DngeConfig=C:/Users/Manoj.Dhayalan/source/myapp/Application/config/myapp-config.properties -Dserver.port=8081 -Dspring.profiles.active=dev"
}
I don't use Visual Studio Code but I managed to change the location of generated class file by putting this lines into my build.gradle file:
compileJava {
options.setAnnotationProcessorGeneratedSourcesDirectory(file("$projectDir/src/main/generated"))
}
This way gradle will generate MyMapperImpl in src instead of build folder and it should be also recognized by VS Code.

VSCode with PHP5

I'm struggling with setting up environment for old tech project with PHP5.
My OS is Windows and I have installed so far VSCode plugins: PHP Debug, PHP Intelephense, PHPUnit, PHPUnit Test Explorer.
I downloaded phpunit-5.7.27.phar and configured VSCode according to documentation.
Settings.json
{
"php.validate.executablePath": "C:/wamp64/bin/php/php5.6.40/php.exe",
"phpunit.phpunit": "C:/wamp64/bin/php/php5.6.40/phpunit-5.7.27.phar",
"phpunit.php": "C:/wamp64/bin/php/php5.6.40/php.exe",
"intelephense.environment.phpVersion": "5.6.40",
"intelephense.environment.includePaths": [
"C:/wamp64/bin/php/php5.6.40/phpunit-5.7.27.phar",
"C:/wamp64/bin/php/php5.6.40/php.exe",
"C:/wamp64/bin/php/php5.6.40/"
]
}
Launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000,
"xdebugSettings": {
"max_children": 256,
"max_data": 500,
"max_depth": 3
}
},
]
}
What works for me fine is breakpointing on running app with xdebug and running unittests with Cmd+Shift+P.
What I need help with are as follows:
Code editor shows error for PHP unit classes and methods (even though unittests are executing fine as is). Do I need to add to path something besides phar file? Is VSCode non-compatible with phar files? The same happens for PHPUnit\Framework\TestCase.
I can't figure out how to configure Test Explorer plugin to show nicely tests tree. Does it require some configuration in Launch.json? Launching tests with Cmd+Shift+P displays results only in terminal.
PHP Intelephense requires installed PHPUnit with composer in workspace.
composer require --dev phpunit/phpunit
PHPUnit Test Explorer has by default Phpunit: Files setting set to {test,tests}/**/*Test.php, so changing it to proper glob should allow plugin to detect all tests.

Custom Code Snippets not showing up in intellisense in visual studio code

I am trying to add a custom code snippets for typescript react. But after adding it, it is not showing in intellisense or in Insert Snippet command window. I performed below steps:
Creating the code snippet. File > Preferences > User Snippets > Typescript React. My json:
"React Component": {
"prefix": "myreactc",
"body": [
"import * as React from "react";"
],
"description": "Adds a react component."
}
Updated following setting:
"editor.tabCompletion": true
Create a new blank TSX file and type: "myreactc" but nothing shows up in intellisense.
I have also restarted visual studio code, but no luck.
Visual Studio Code Details:
Version 1.14.2
Commit cb82febafda0c8c199b9201ad274e25d9a76874e
Date 2017-07-19T23:34:09.706Z
Shell 1.6.6
Renderer 56.0.2924.87
Node 7.4.0
Any help?
I realized that the code was commented :) The default template has the code commented, i updated the code but forgot to uncomment the code.
I was stupidly changing the snippet name and not the snippet prefix
"For Loop": {
"prefix": "my name for intellisense",
"body": [