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

Live Server VScode: This page isn’t working 127.0.0.1 didn’t send any data. ERR_EMPTY_RESPONSE

$
0
0

I wanted to establish a live server , and quickly came across this extension.

After installing I clicked on the Go live button on right hand side corner.

A tabs automatically opens up in chrome browser , with this error message.

I have tried doing this , with no success.

enter image description here


How can I disable GPU rendering in Visual Studio Code

$
0
0

I'm with bad rendering issues... Seems that the Visual Studio Code window do not clean a screen area before redraw it. The same thing happens here with chrome browser, but in chrome I can start it with " --disable-gpu-rendering " and it goes well.

How can I disable GPU rendering in Visual Studio Code ?

I'm thinking it's a hardware specific problem, and I'm looking for a other way to solve it too.

May be useful know my hardware:

Machine: Notebook dell vostro 3500 (intel chipset)CPU: Intel i5RAM: 8Glinux kernel: 4.0video graphics: intel i915 (latest)X -version: X.Org X Server 1.14.0

VSCode and Eslint not recognises new Files with CRA only after reload Window

$
0
0

Eslint (VSCode Extention) not working with new Typescript Files in a CRA Application. I always need to reload Window. Then everything working fine.

In this case the Problem is in Test.tsx

tsconig.json:

{"compilerOptions": {"target": "es2017","lib": ["dom","dom.iterable","esnext"    ],"allowJs": true,"skipLibCheck": true,"esModuleInterop": true,"allowSyntheticDefaultImports": true,"strict": true,"forceConsistentCasingInFileNames": true,"module": "esnext","moduleResolution": "node","resolveJsonModule": true,"isolatedModules": true,"noEmit": true,"jsx": "react"  },"include": ["src"  ],}

.eslint.js

module.exports = {  env: {    browser: true,    es6: true,  },  extends: ['plugin:react/recommended', 'airbnb-typescript', 'plugin:prettier/recommended', 'prettier/react'],  globals: {    Atomics: 'readonly',    SharedArrayBuffer: 'readonly',  },  parser: '@typescript-eslint/parser',  parserOptions: {    ecmaFeatures: {      jsx: true,    },    ecmaVersion: 2018,    sourceType: 'module',    project: './tsconfig.json',  },  plugins: ['react', '@typescript-eslint'],  rules: {'spaced-comment': ['error', 'always', { markers: ['/'] }],  },  overrides: [    {      files: ['*.test.tsx', '*.test.ts', 'setupTests.ts', './src/testUtils/*'],      rules: {'import/no-extraneous-dependencies': 'off',      },    },    {      files: ['*.stories.tsx', '*.stories.ts'],      rules: {'import/no-extraneous-dependencies': 'off',      },    },  ],};

deps in package.json

"dependencies": {"@material-ui/core": "^4.9.9","css": "^2.2.4","react": "^16.13.1","react-dom": "^16.13.1","styled-components": "^5.1.0","typescript": "~3.7.2"  },"devDependencies": {"@storybook/addon-actions": "^5.3.18","@storybook/addon-docs": "^5.3.18","@storybook/addon-knobs": "^5.3.18","@storybook/addon-links": "^5.3.18","@storybook/addons": "^5.3.18","@storybook/preset-create-react-app": "^2.1.1","@storybook/react": "^5.3.18","@testing-library/jest-dom": "^4.2.4","@testing-library/react": "^9.3.2","@testing-library/user-event": "^7.1.2","@types/enzyme": "^3.10.5","@types/enzyme-adapter-react-16": "^1.0.6","@types/jest": "^24.0.0","@types/react": "^16.9.0","@types/react-dom": "^16.9.0","@types/styled-components": "^5.0.1","enzyme": "^3.11.0","enzyme-adapter-react-16": "^1.15.2","eslint-config-airbnb-typescript": "^7.2.0","eslint-config-prettier": "^6.10.1","eslint-plugin-prettier": "^3.1.2","prettier": "^2.0.4","react-scripts": "3.4.1","storybook-addon-styled-component-theme": "^1.3.0"  },

Output of DEBUG=typescript-eslint:* yarn eslint src/**/*:

DEBUG=typescript-eslint:* yarn eslint src/**/*yarn run v1.22.4$ /home/dietmar/vsCodeProjects/smartHome.component-library/node_modules/.bin/eslint src/components/button.stories.tsx src/components/Button.tsx src/components/styled-button.stories.tsx src/components/styled-button.tsx src/components/Test.tsx src/docs/Introduction.stories.mdx src/testUtils/mountWithTheme.tsx src/testUtils/renderWithTheme.tsx src/testUtils/shallowWithTheme.tsx src/themes/darkTheme.ts src/themes/ITheme.ts src/themes/lightTheme.ts  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: /home/dietmar/vsCodeProjects/smartHome.component-library/src/components/button.stories.tsx +0ms  typescript-eslint:typescript-estree:createWatchProgram File did not belong to any existing programs, moving to create/update. /home/dietmar/vsCodeProjects/smartHome.component-library/src/components/button.stories.tsx +0ms  typescript-eslint:typescript-estree:createWatchProgram Creating watch program for /home/dietmar/vsCodeProjects/smartHome.component-library/tsconfig.json. +0ms  typescript-eslint:typescript-estree:createWatchProgram Running without timeout fix +1ms  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: /home/dietmar/vsCodeProjects/smartHome.component-library/src/components/Button.tsx +3s  typescript-eslint:typescript-estree:createWatchProgram Found existing program for file. /home/dietmar/vsCodeProjects/smartHome.component-library/src/components/Button.tsx +3s  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: /home/dietmar/vsCodeProjects/smartHome.component-library/src/components/styled-button.stories.tsx +67ms  typescript-eslint:typescript-estree:createWatchProgram Found existing program for file. /home/dietmar/vsCodeProjects/smartHome.component-library/src/components/styled-button.stories.tsx +66ms  typescript-eslint:typescript-estree:createIsolatedProgram Getting isolated program in TSX mode for: /home/dietmar/vsCodeProjects/smartHome.component-library/src/components/styled-button.tsx +0ms  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: /home/dietmar/vsCodeProjects/smartHome.component-library/src/components/styled-button.tsx +38ms  typescript-eslint:typescript-estree:createWatchProgram Found existing program for file. /home/dietmar/vsCodeProjects/smartHome.component-library/src/components/styled-button.tsx +38ms  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: /home/dietmar/vsCodeProjects/smartHome.component-library/src/components/Test.tsx +46ms  typescript-eslint:typescript-estree:createWatchProgram Found existing program for file. /home/dietmar/vsCodeProjects/smartHome.component-library/src/components/Test.tsx +46ms  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: /home/dietmar/vsCodeProjects/smartHome.component-library/src/testUtils/mountWithTheme.tsx +22ms  typescript-eslint:typescript-estree:createWatchProgram Found existing program for file. /home/dietmar/vsCodeProjects/smartHome.component-library/src/testUtils/mountWithTheme.tsx +22ms  typescript-eslint:typescript-estree:createIsolatedProgram Getting isolated program in TS mode for: /home/dietmar/vsCodeProjects/smartHome.component-library/src/themes/lightTheme.ts +114ms  typescript-eslint:typescript-estree:createIsolatedProgram Getting isolated program in TS mode for: /home/dietmar/vsCodeProjects/smartHome.component-library/src/themes/ITheme.ts +6ms  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: /home/dietmar/vsCodeProjects/smartHome.component-library/src/testUtils/renderWithTheme.tsx +55ms  typescript-eslint:typescript-estree:createWatchProgram Found existing program for file. /home/dietmar/vsCodeProjects/smartHome.component-library/src/testUtils/renderWithTheme.tsx +55ms  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: /home/dietmar/vsCodeProjects/smartHome.component-library/src/testUtils/shallowWithTheme.tsx +42ms  typescript-eslint:typescript-estree:createWatchProgram Found existing program for file. /home/dietmar/vsCodeProjects/smartHome.component-library/src/testUtils/shallowWithTheme.tsx +42ms  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: /home/dietmar/vsCodeProjects/smartHome.component-library/src/themes/darkTheme.ts +44ms  typescript-eslint:typescript-estree:createWatchProgram Found existing program for file. /home/dietmar/vsCodeProjects/smartHome.component-library/src/themes/darkTheme.ts +44ms  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: /home/dietmar/vsCodeProjects/smartHome.component-library/src/themes/ITheme.ts +35ms  typescript-eslint:typescript-estree:createWatchProgram Found existing program for file. /home/dietmar/vsCodeProjects/smartHome.component-library/src/themes/ITheme.ts +35ms  typescript-eslint:typescript-estree:createProjectProgram Creating project program for: /home/dietmar/vsCodeProjects/smartHome.component-library/src/themes/lightTheme.ts +22ms  typescript-eslint:typescript-estree:createWatchProgram Found existing program for file. /home/dietmar/vsCodeProjects/smartHome.component-library/src/themes/lightTheme.ts +22ms/home/dietmar/vsCodeProjects/smartHome.component-library/src/docs/Introduction.stories.mdx  0:0  warning  File ignored because of a matching ignore pattern. Use "--no-ignore" to override✖ 1 problem (0 errors, 1 warning)Done in 4.72s.

Arabic text in vscode integrated terminal

$
0
0

I have a python code that prints Arabic text on vscode terminal, the output in the terminal appears in "unreadable" format.

code:

print('مرحبا')

output:

مرحبا

How can I solve this issue?

vscode remote netcoreapp 3.0 WPF

$
0
0

Maybe I do misunderstand vscode remote, but I thought, it is finally possible to write a wpf application on mac os. I setup to ssh into my windows machine and have a remote session running to see the wpf application running and control it. But a big nono.

The second I use dotnet run, I get a -1 return code of the build command.

So am I wrong, that vscode remote would run everything on the target machine or did I misunderstood something really badly and thus it is not possible to use vscode remote to write a wpf application on any os?

Any help is highly recommended.

How to Move a Line Up or Down in Visual Studio Code for Mac

$
0
0

I'm familiar with how to move a line up or down in other editors, like Atom and Sublime.

How is this done in Visual Studio Code for Mac?

VS code cannot compile mutiple C++ files(WSL)

$
0
0

I just started to setup my vs code in WSL. I followed by the instruction from GCC on Windows subsystem for Linux. Most of the work is done, there is only one issue.For this part:Modifying tasks.jsonYou can modify your tasks.json to build multiple C++ files by using an argument like "${workspaceFolder}/*.cpp" instead of ${file}. You can also modify the output filename by replacing "${fileDirname}/${fileBasenameNoExtension}" with a hard-coded filename (for example 'helloworld.out').

I want to compile multiple cpp files, but the method provides from above "${workspaceFolder}/*.cpp" instead of ${file} doesn't work for me. After I replaced it, the g++ seems like recognize the *.cpp as a file so it can't find it.

This is what the terminal shows.g++: error: /.../.../*.cpp: No such file or directoryg++: fatal error: no input filescompilation terminated.The terminal process terminated with exit code: 1

Visual studio code refactoring does not seem to work (e.g. rename symbol - f2)

$
0
0

So I have just installed vscode on ubuntu at version: 1.27.2. I have installed the extension for c++ as well.

Its all working nicely, except that I cant seem to use the refactor actions. Specifically I want to use the rename symbol (f2).

When I click a variable and press f2 nothing happens. If I do ctrl+shift+r (refactor actions) I always get "no refactorings available".

I checked the key-bindings and it shows for "f2":

  • Command: Rename Symbol
  • Keybinding: F2
  • Source: Default
  • When: editorHasRenameProvider && editorTextFocus && !editorReadonly

So I checked that the editor is writeable and text has focus - both true. But I am not sure what this editor has rename provider is?

So I need to install something else? - how can I get refactoring working?

Update

This has now been implemented in vscode-cpptools extension: version v0.26 called "rename symbol".


import javax.servlet in vscode not recognised

$
0
0

I have downloaded the javax.servlet-3.0.jar file and added it to my classpath too. But still I get error saying

"package javax.servlet.http does not existimport javax.servlet.http.HttpServletRequest; ",

I get same error for HttpServletResponse, WebServlet and ServletException. You can see in the pictures the jar files I have added to the classpath and the errors I got

classpath, referenced libraries and added jar files

swiggles under import lines

Angular VSCode code completion like in WebStorm?

$
0
0

Because of the current better implementation with the development of WSL with VSCode compared to WebStorm, I try to configure VSCode as close as possible to WebStorm.

This works already quite well, except for the code completion of Angular directives and input and output properties like in this simple example:

import {Component, Input, OnInit, Output} from '@angular/core';import {EventEmitter} from 'events';@Component({   selector: 'app-mycomp',   templateUrl: './mycomp.component.html',   styleUrls: ['./mycomp.component.scss']})export class MycompComponent implements OnInit {  @Input() in: string;  @Output() out = new EventEmitter();  constructor() {  }  ngOnInit(): void {  }}

When I try to integrate this component into another one, the code completion in WebStorm looks like this

webStorm code completion

In VSCode it looks like this:

VSCode autocomplete

This is not very useful and currently the only thing keeping me from a complete change to VSCode.

Is there a way to configure the Angular Language Service accordingly ?

Modifying a snippet in VSCode

$
0
0

In VSCode, if I type doc and press the tab key on my keyboard, the following snippet gets added automatically to the html file:

<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><link rel="stylesheet" href="style.css"></head><body><script src="main.js"></script></body></html>

But I want to modify this snippet to the following:

<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><link rel="stylesheet" href="style.css"></head><body><script src="main.js"></script></body></html>

After some googling, I tried this: Hit > shift + command + p and type snippetsSelect Preferences: Open User SnippetsChoose the language type for which you want to add the custom snippet (html in my case) and you can modify your custom snippet.

The problem is that inside the htmll.json, I can't see any snippet for the doc shortcut.How can I modify the snippet for doc shortcut for html files?

Visual Studio Code compile on save

$
0
0

How can I configure Visual Studio Code to compile typescript files on save?

I see it is possible to configure a task to build the file in focus using the ${file} as an argument. But I would like this to be done when a file is saved.

How to add Nuke API to Vs code?

$
0
0

New to Python. I am using VS code for learning python and python for nuke.Is there anyway to add Nuke API to Vs Code?

How include node_modules in output directory with TypeScript

$
0
0

I want to know if it possible copy node_modules folder into output directory after run tsc command.

My situation it that I have a project with TypeScript and use some npm packages. And i need that my output directory has all npm dependencies, because i need to compress it and send by http (to AWS Lambda).

My project structure is like this:

|-.vscode --> visual studio code|-lib --> output dir|-node_modules --> npm dependencies|-src --> .ts files|-jsconfig.json|-tsconfig.json

How can achieve it?

Thanks a lot!

Visual Studio Code: Paperscript


My flutter project runs on iOS simulator but it doesn't run with blank screen on real device, why?

$
0
0

I'm already learning flutter and I did my first project but I cannot run on my iPhone X(it's up to date) also it runs on simulator. When I tried to run on my device it is blank(white) screen. I couldn't solve this problem and I tried everything I know. I tried that "iOS build --release", upgrade flutter, Xcode, VS code and my device, flutter clean and re-build and few more...PLEASE HELP!!!!

By the way I am using MacBook Pro...

Code snippet with special sign = '"' in VSCode

$
0
0

I have written following snippet:

"Insert IMG": {"prefix": "iimg","body": ["<img src='./img/$1/$2'><br><br>",    ],"description": "Insert image to MD file"}

but in the body I want to have:

"<img src="./img/$1/$2"><br><br>",

How to achieve it? I was trying with hex code but does not work ;/

"UnhandledPromiseRejectionWarning: Error: Forbidden" while sending email from sendGrid in Node.js

$
0
0

I'm integrating sendgrid in my node.js project with the following code as per instructions on their website

const sgMail = require('@sendgrid/mail')const sendGridAPIKey = "API key"sgMail.setApiKey(sendGridAPIKey)const msg = { to: 'agrawalanuj751997@gmail.com', from: 'agrawalanuj751997@gmail.com', subject:'My first mail from node', text:"I'm sending myself an email"}sgMail.send(msg)

I'm getting the following error in my log. I've tried multiple API keys from multiple accounts but still, I'm getting the same error.

(node:16043) UnhandledPromiseRejectionWarning: Error: Forbiddenat Request._callback (node_modules/@sendgrid/client/src/classes/client.js:124:25)at Request.self.callback (node_modules/request/request.js:185:22)at Request.emit (events.js:200:13)at Request.<anonymous> (node_modules/request/request.js:1154:10)at Request.emit (events.js:200:13)at IncomingMessage.<anonymous> (node_modules/request/request.js:1076:12)at Object.onceWrapper (events.js:288:20)at IncomingMessage.emit (events.js:205:15)at endReadableNT (_stream_readable.js:1154:12)at processTicksAndRejections (internal/process/task_queues.js:84:9)(node:16043) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)(node:16043) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

VScode autocomplete doesn't work for CSS files

$
0
0

Autocomplete for CSS is not working in VSCode.

enter image description here

Usually, if I start writing an statement inside a CSS file, VSCode has an intenseness, which suggested all possible options.But as you can see, it doesn't work inside my css file.

Any help?

Python code won't open file in virtual studio code

$
0
0

So I have an assignment for college in python and for a part of it, I need to open the file "voting.txt". I coded up the assignment in Pycharm, as that's the IDE we use in college, but my preferred IDE is VSCode. In Pycharm the code works fine. I run the code and I get the results I want. However, when I try to run the code in VSCode, I get a FileNotFoundError. The file I want to open is in the same directory as the code that opens it. I don't know whether there's a setting that tells VSCode to look for the file in a specific directory, or what, but I'm hoping someone will have a solution. Below is the python code to open the file, so as you can see, the syntax is correct, and as i said, the text file and the python file containing the code that opens it is in the same directory:

fileOut = open("voting.txt", "r")
Viewing all 98845 articles
Browse latest View live


Latest Images

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