Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all 97270 articles
Browse latest View live

Groovy formatter/beautifier in Visual Studio Code [closed]

$
0
0

For supported files in VSCode we get an option (when you right click on the file editor) to Format Document (ALT+SHIFT+F).

But unfortunately for Groovy this option is not available. And according to the VSCode community, there are no plans to implement this feature.

Is there an alternative solution available, specifically for VSCode?


How to hard-wrap lines in VS Code at a specific character (NOT word wrap)

$
0
0

I have a Base64 encoded string in a text file that is one line. In other words it contains no line breaks. I want to insert a line break every 78 characters.

None of the "wrap" extensions I have found do this, since they're geared for word wrapping and use word boundaries. Running any of these functions does nothing since the string contains no spaces or word boundaries.

I can do it on Unix using something like fold -w 78 but this seems like something that should exist in VS Code or at least an extension.

Cucumber (Gherkin) Full support extension for VS Code was unable to find step for

$
0
0

I'm using VS Code and Cucumber extension https://marketplace.visualstudio.com/items?itemName=alexkrechik.cucumberautocomplete&ssr=false#overview doesn't work. This is my settings.json in .vscode folder:

{
"cucumberautocomplete.steps": [
    "src/step_definitions/*.js",
],
"cucumberautocomplete.syncfeatures": "src/features/*feature",
"cucumberautocomplete.strictGherkinCompletion": true,
"cucumberautocomplete.strictGherkinValidation": true,
"cucumberautocomplete.smartSnippets": true,
"cucumberautocomplete.stepsInvariants": true,
// "cucumberautocomplete.pages": {
//     "users": "test/features/page_objects/users.storage.js",
//     "pathes": "test/features/page_objects/pathes.storage.js",
//     "main": "test/features/support/page_objects/main.page.js"
// },
"cucumberautocomplete.skipDocStringsFormat": true,
"cucumberautocomplete.formatConfOverride": {
    "And": 3,
    "But": "relative",
},
"cucumberautocomplete.onTypeFormat": true,
"editor.quickSuggestions": {
    "comments": false,
    "strings": true,
    "other": true
},
"cucumberautocomplete.gherkinDefinitionPart": "(Given|When|Then)\\(",
"cucumberautocomplete.stepRegExSymbol": "'"
}

And this is what I have added to settings.json of VS Code:

{
"workbench.colorTheme": "Default Light+",
"editor.quickSuggestions": true,
"window.zoomLevel": 0
}

When in my feature file I get the message for each line: "Was unable to find step for "Given I am on the dashboard page"cucumberautocomplete"

Can someone help to resolve this issue and make it work for VS Code?

Kind regards, mismas

Visual Studio Code - Delete Older Version

$
0
0

Can I delete older versions of visual studio code? I'm not sure why but my computer seems to have 3 different versions on my laptop. Will deleting one somehow affect a newer version?

How do I debug Neutralino in VS Code?

$
0
0

I'm new to NuetralinoJS and web dev in general, so please go easy on me. I tried following the tutorial here with some slight variations:

https://neutralino.js.org/docs/#/gettingstarted/firstapp

And find "Step 5 - Debugging" to be too vague to be helpful. How would I go about "Chang[ing] neutralino mode in to browser?" Would someone be able to fix my launch.json? There didn't seem to be anything for Neutralino, but found other for webpack, etc, but the configs there didn't work.

I can call

npm run build

and the project builds successfully, I can run it, but just can't debug it. That is:

./neutralino-linux

works! But no debugger is attached :(

Please help, I need an expert!

Steps: 1) Generate NeutralinoJS project:

neu create myapp --template typescript

2) In VS Code, File -> Open Folder -> Select 'myapp' directory in file-browser

3) In VS Code, Run -> Add Configuration

launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "runtimeArgs": ["--harmony"],
            "request": "launch",
            "name": "Launch Webpack",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "sourceMaps": true,
            "program": "${workspaceFolder}/src/app.ts",
            "preLaunchTask": "npm: build",
            "smartStep": true,
            "internalConsoleOptions": "openOnSessionStart",
            "outFiles": [
                "${workspaceFolder}/dist/**/*.js"
            ],
            "cwd": "${workspaceFolder}"
        }
    ]
}

4) Modify the tsconfig.json file

tsconfig.json

{
    "compilerOptions": {
        "outDir": "./dist/",
        "noImplicitAny": false,
        "module": "es6",
        "moduleResolution": "node",
        "target": "es6",
        "allowJs": true,
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "types": ["reflect-metadata"],
        "lib": ["es6", "dom"],
        "sourceMap": true
    },
    "include": [
        "./src/**/*"
    ]
}

5) Add '.js' to extensions in webpack.config.js

webpack.config.js

const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');

module.exports = {
  entry: path.resolve(__dirname, './src/app.ts'),
  devtool: 'source-map',
  module: {
    rules: [
      {
        test: /\.ts?$/,
        use: 'ts-loader',
        exclude: [
          /node_modules/,
          /deps/
        ],
      },
      {
        test: /\.css$/i,
        use: [
          {
            loader: MiniCssExtractPlugin.loader,
          },
          'css-loader',
        ],
      },

    ],
  },
  resolve: {
    extensions: ['.ts', '.js'],
  },
  output: {
    filename: 'app.js',
    path: path.resolve(__dirname, './app/assets'),
  },
  plugins: [
    new MiniCssExtractPlugin({
      filename: 'app.css'
    }),
  ],
};

6) npm install "other dependencies"

package.json

{
  "name": "neutralinojs-typescript",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "build": "webpack -p --config webpack.config.js",
    "test": "echo \"Error: no test specified\"&& exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "css-loader": "^3.4.0",
    "extract-text-webpack-plugin": "^3.0.2",
    "mini-css-extract-plugin": "^0.9.0",
    "ts-loader": "^6.2.1",
    "typescript": "^3.7.4",
    "webpack": "^4.41.4",
    "webpack-cli": "^3.3.10"
  },
  "dependencies": {
    "inversify": "^5.0.1",
    "reflect-metadata": "^0.1.13",
    "rxjs": "^6.5.4",
    "rxjs-compat": "^6.5.4",
    "source-map": "^0.7.3",
    "whatwg-fetch": "^3.0.0"
  }
}

Thanks in advance!

Referencing a JSON schema from the current directory

$
0
0

Given a file appsettings.json and a JSON schema file appsettings.schema.json which both reside in the same folder, how can you use the $schema property to point to the schema file so that it loads without error?

eg.

appsettings.json

{
  "$schema": "appsettings.schema.json",
  ...
}

appsettings.schema.json

{
  ...
}

With the above path, I get an error in Visual Studio Code:

Unable to load schema from '\appsettings.schema.json': ENOENT: no such file or directory, open 'c:\appsettings.schema.json'.

how to set vscode intellisense to work with nvm

$
0
0

I'm havibg trouble setting up vscode to work with nvm. I've installed node 13.12.0 by running nvm install node it's installed in my home folder under /home/$USER/.nvm/versions/node/v13.12.0.

I don't seem to have entirety of js intellisense in vscode. It seems to pick node modules installed with yarn, but not global modules like fs or readline. I was able to set some workarounds for debugging by setting runTimeExecutable in launch.json.

I've set some setting to use nvm path, but no matter what I do I can't get intellisense to work properly.

"eslint.nodePath": "/home/$USER/.nvm/versions/node/v13.12.0/bin/node",
"eslint.packageManager": "yarn",
"prettier.packageManager": "yarn",
"npm.packageManager": "yarn",
"typescript.npm": "/home/$USER/.nvm/versions/node/v13.12.0/bin/npm",
"eslint.runtime": "/home/$USER/.nvm/versions/node/v13.12.0/bin/node",
"code-runner.runInTerminal": true

This seems to be a common issue with nvm, any suggestions on how to remedy this?

VSCode editor - Restart NodeJs server when file is changed

$
0
0

I am using Visual Studio Code as my editor for NodeJS project.

Currently I need to manually restart server when I change files in my project.

Is there any plugin or configuration change in VSCode that can restart NodeJS server automatically when I make change in files.


Visual studio code doesn't open project folder.

$
0
0

I have different subfolders under my project folder. I could open all of them in visual code other than one folder which was opening previously. When I click on open, the screen is displaying with the folder title but nothing appears on the screen. Please help as I am new to visual studio code

Dataset production using SQL Server Management Studio, Visual Studio Code, Azure Data Studio, Visual Studio

$
0
0

I regularly use SSMS to query data and build datasets, my IT department handle the database administration.

Recently I found out about Azure Data Studio and I liked:

  • intellisense
  • source code control (e.g. with Git)
  • extensions from the community
  • SQL snippets, automating code writing and are even customisable
  • Notebooks - the ability to run code alongside comments in markdown. Amazing for live documentation. It enables you execute code in different languages on the same page!

In addition to this I see Visual Studio Code (and Visual Studio). VS Code and ADS seem so similar especially once you add in extensions. The overlap between the products is confusing.

I don't have SQL Server 2019 and Big Data Clusters. I am looking for a program that has notebook functionality in SQL, R and Python. Although it seems like there are better products for developing R code e.g. R studio.

I'd like to be trying alternatives to SSMS to establish different future work flows. At the moment it feels hard to wholeheartedly recommend any options.

Does anyone have a good any idea about how this all fits together?

Enable focus follows mouse between editor and integrated terminal in VSCode

$
0
0

I am used to the focus follows mouse option for years.

In the VSCode editor I want to switch between the integrated terminal and the code writer by simply focusing the cursor on them.

For example in Geany editor: enter image description here

Does anyone know how to enable focus follows mouse from settings or using any simple hack while trying to move between the code writer and terminal?

Visual Studio Code terminal cannot use proxy

$
0
0

I tried to do a maven clean for a project in Visual Studio Code but I got an exception of java.net.UnknownHostException: repo.maven.apache.org. I suspect this is caused by proxy as the development environment here requires a proxy for Internet access, and we use .pac file in IE proxy setting.

In File -> Preferences -> Settings -> User -> Application -> Proxy, I setup the proxy address as http://username:password@my.proxy.address:8080. In settings.json, I put as followings:

{
    "http.proxy": "http://username:password@my.proxy.address:8080",
    "https.proxy": "http://username:password@my.proxy.address:8080",
    "http.proxyStrictSSL": false
}

Now I am able to search for extensions, but terminal is not working. How can I solve it?

Python in VS Code: Auto-completion (IntelliSense) not working for object instances in the editor tab

$
0
0

I'm new to Python and I'm trying to use VS Code as IDE, and it's IntelliSense (auto-completion) to improve the development.

But I find that the IntelliSense is not working for object instances in the Editor Tab.

I have the example on the figure below, where I created a figure and tried to access its properties via IntelliSense on the editor tab: the properties are not available, only variables.

What is curious is that: on the Python Interactive Tab, the IntelliSense (autocomplete) works fine, for the same object. This example is in the same figure below.

I've tried to disable the Jedi IntelliSense, but it didn't change anything.

enter image description here

The code used in the image is as follows

import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(0,10,1000)
y = np.cos(x)

fig,ax = plt.subplots()
ax.plot(x,y)

custom highlighting in VS code

$
0
0

For C as well as C++ I have certain macros and function names for which I want a special color. Back with Kate and notepad++ I could simply go to 'options' or 'settings' and I could whatever I want in these menus for any language.

With VS code I don't know even where to look for which .json files. Nor I know what I could possibly fill in in these .jsons

The one thing I managed to do is to add these global keywords such as BUG or FIXME. Those are ofcourse valid in every language.

Sometimes I am re-attempting to actually get keyword highlighting in VScode. I am still nowhere. I cannot find any working answers on the internet which is extremely frustrating. I want to do an incredible simple and standard thing in the propably most advanced text editor available. And I can't even find it.

I just want to be able to add keywords and give them colors per language. How do I do that?

Setting up GitWebLinks extension in VS/vscode

$
0
0

The extension I am talking about can be found in these two links:

  1. https://marketplace.visualstudio.com/items?itemName=reduckted.GitWebLinks
  2. https://marketplace.visualstudio.com/items?itemName=reduckted.vscode-gitweblinks

This extension enables you to create hyperlinks from the editor to your git file/selection on the server.

There is specified that the extension provides support for Azure Dev Ops. It should be straight forward, but maybe there is something that I am missing in the setup.

From vscode when I try to use the commands:

  • Git Web Links: Copy Web Link to Section
  • Git Web Links: Copy Web Link to File

I am getting the error This workspace is not tracked by Git (and I am pretty sure that I am tracking the workspace by Git).

Is there any configuration that I need to set in order to make it work for Azure Dev Ops? Did anyone else faced the same issue with this extension?


Tokenisation notification is Visual Studion Code

$
0
0

Usually I can see on load of my IDE this message:

Tokenization is skipped for long lines for performance reasons. The length of a long line can be configured via `editor.maxTokenizationLineLength`.

How much this can impact performance?

In Visual Studio Code Ctrl+V is not working?

$
0
0

In Visual Studio Code Ctrl+V is not working on editor.

However From the Command Palette Ctrl+Shift+V is working.

How to setup VS code debugging in Windows when running WSL?

$
0
0

I cannot figure out how to setup debugging in VS Code so I can serve the app with node in WSL. I am using:

  • Debugger for Chrome
  • React app created with create-react-app
  • Starting server in bash (WSL) via npm start

This works in that is launches a new browser window and the app is served, but I cannot set any break points. They all report Unverified breakpoint.

This is my launch.json:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "React",
      "type": "chrome",
      "request": "launch",
      "url": "http://localhost:3000",
      "webRoot": "${workspaceRoot}/src"
    }
  ]
}

The problem seems related to webpack, but I can't figure out what I need to do differently.

How to setup output path to compiled css files using `vscode live sass compiler extension` in windows10?

$
0
0

I failed to run node-sass(node module), where I was able to setup path for input extensions.scss files and output files generated after compiling to dist/ folder.

Now, I am using vscode extension live sass compiler,

at bottom bar, when I clicked Watched Sass then it compiled automatically scss file to css but in same folder.

main.scss is compiled to main.css.

enter image description here

problem is that I wanted to create that compiled css file in other folder .i.e. in output folder ./dist/.

I have manually created main.css file in ./dist/folder.

How can I setup path to source and destination files in that extension?

Configuring Java Extension Pack in Remote WSL on VSCode

$
0
0

My question is similar to this. I am trying to work with Java in Remote-WSL using VSCode. According to VSCode guidelines, I should install the Java Extension Pack on WSL. However, when I try to install it I get the following error:

The java.home variable defined in Visual Studio Code settings points to a missing or inaccessible folder (C:\Program Files\Java\jdk-9.0.1)

This is what the Java Extension pack shows when I install it on WSL.

enter image description here

I have been able to resolve this issue if I change the path in java.home to be same as JAVA_HOME in settings.json. However, I need to toggle the path back to C:\Program Files\Java\jdk-9.0.1 manually when working on my local machine and not on Remote-WSL.

Is there a better way to make it work?

PS: I've no clue why it says that JDK_HOME is empty. If I echo $JDK_HOME inside WSL, it shows the path same as JAVA_HOME.

Viewing all 97270 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>