Tag Archives: vscode

Error in intellicode extension of vscode [Solved]

after vscode upgrade, open the java file, and vscode pops up:

Sorry, there was a problem activating IntelliCode support for Java. For more information
Please see the "Language Support for Java" and "VS IntelliCode" output windows

the reason is that the language support for Java by red hat extension version above 0.65 only supports versions above java11, so it will revert to versions below 0.64.1

[Solved] VS Code Debug JavaScript Error: “crbug/1173575, non-JS module files deprecated”

  According to the online method (VSCODE debug Javascript), after installing the debugger for Chrome extension, debug JavaScript, the result is not able to display the web page in the browser correctly, the wrong report: “crbug/1173575, non-JS module files deprecated”, as shown in the following figure:

resolvent:

Open launch.json and change the port number in “URL” in “configurations” to the port number of live server

Save, and then press F5 again to debug normally

Error: EACCES: permission denied, unlink ‘xxxx/xxxx/xxxx‘ [How to Solve]

Scenario: on the Mac, if you want to use the code command to open vs code, (CMD + Shift + P) search the shell, find this:

Results Click to find:

	Error: EACCES: permission denied, 
	unlink '/usr/local/bin/code'

In fact, I don’t have read-write permission, and it’s ineffective to search a lot on the Internet. However, I’m used to using the command line to open vs code. The final solution is:

Enter at the command line

sudo chown -R [yourusername] [filePath]

Yourusername: user preferences – & gt; Users and groups – & gt; Current user
filepath: the path displayed when an error is reported

Tips: if not, try to move the path forward. Take me as an example:

sudo chown -R xxx /usr/local/bin

Vscode cannot write user settings. Open user settings, clear errors or warnings, and then type again

Vscode cannot write user settings. Open user settings, clear errors or warnings, and then type again

Question: in the evening, when my younger brother asked me about his vscode installation plug-in, it always showed that the user settings could not be written. Please open the user settings, clear the errors or warnings, and then repeat the warning. So I looked at it remotely for him, missing a bracket

Solution

In case of such an error, open the problem first, and you will be prompted that there is a problem with the settings.json file. Click to open the settings configuration settings.json file.

If you uninstall some plug-ins, the settings.json will show that the configuration of the uninstalled plug-ins is gray. Delete the gray line to ensure that your file JSON format is correct. At this time, if you select the default configuration of some functions, you will not be prompted that the user configuration cannot be written.

Check whether the settings.json file has red wavy lines, commas, parentheses, etc


[How to Solve] Kernel died with exit code 1.

  When jupyter is installed on the vscode and a sentence of Python code is calculated randomly in the ipynb file, the error of kernel died with exit code 1, C:: (users, hpccp, appdata, roaming, python, python38, site packages, traitlets) appears. I’ve been looking for solutions on the Internet all the time. I’ve spent a lot of energy trying many solutions, but I can’t, Because the error of kernel died with exit code 1 may be caused by many different details, and the root cause of the error is different. Of course, other people’s solutions may not be applicable to themselves.

So I began to pay attention to the details of my error. I wonder if there is something wrong with this folder, because my vscode and juptyer plug-ins have just been re installed (I have repeatedly uninstalled and re installed several times, but the first two have not been completely uninstalled), C: The folder was created before. I deleted the folder and its contents. Then the problem was solved.

Vscode compiles multiple files, compiles files in subfolders

Shame to say, in fact, for vscode configuration, the writer of C/C + + only referred to the tutorial, and then copied several JSON files, but did not understand the meaning.

For this problem, we need to solve the compilation problem, so in task.json, my configuration file is as follows

in which two parameters are command and args

Command: compiler for compilation args: command for compilation

As a matter of fact, it can be seen from the familiar partners of GCC. Here we post the parameter

so we need to connect our file names. The workspace in front represents the workspace, so we only need to write our own directory name at the back, as shown in the figure of linear_ List, connect them.

Solved: could not find the task ‘G + + build active file, leetcode algorithm ACM compilation and debugging

Project scenario:

Environment: Ubuntu 20.04

Tool: vscode

Because leetcode can’t debug the code (for members), it’s necessary to configure the local environment to run the code.

Leetcode’s code is to help you configure all the environments. You only need to write the core code, but you need to write all the code yourself during the interview. It’s ACM mode (Baidu ACM). At this time, if you don’t often write all the code, it’s easy to be confused (this is what happened when I was deeply convinced in the online interview)

So it’s necessary to configure the local environment and write the whole process of algorithm implementation, including the compilation process and principle of cpp file, and the debug process can make you more familiar with the code running process.

Reference for compiling environment configuration: https://code.visualstudio.com/docs/cpp/config-linux

No Baidu, no Baidu! Look at the official statement is always the best!!! If you don’t understand English, you can right-click to translate the web page directly.

My task.json configuration: it is automatically generated. The configuration of the computer and the environment is different, so this file may be different.

{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "cppbuild",
			"label": "C/C++: g++ Generate activity files",
			"command": "/usr/bin/g++",
			"args": ["-g", "${file}", "-o", "${fileDirname}/${fileBasenameNoExtension}"],
			"options": {
				"cwd": "${fileDirname}"
			},
			"problemMatcher": [
				"$gcc"
			],
			"group": {
				"kind": "build",
				"isDefault": true
			},
			"detail": "Compilers: /usr/bin/g++"
		}
	]
}

My launch.json:

{
    "version": "0.2.0",
    "configurations": [
      {
        "name": "g++ build and debug active file",
        "type": "cppdbg",
        "request": "launch",
        "program": "${fileDirname}/${fileBasenameNoExtension}",
        "args": [],
        "stopAtEntry": false,
        "cwd": "${workspaceFolder}",
        "environment": [],
        "externalConsole": false,
        "MIMode": "gdb",
        "setupCommands": [
          {
            "description": "Enable pretty-printing for gdb",
            "text": "-enable-pretty-printing",
            "ignoreFailures": true
          }
        ],
        "preLaunchTask": "g++ build active file",
        "miDebuggerPath": "/usr/bin/gdb"
      }
    ]
  }

Problem Description.
I encountered the following situation when configuring task.json for compiling C++ and debugging configuration file launch.json.


Cause Analysis.
Code encountered problems suggest direct google …
Reference: https://stackoverflow.com/questions/59106732/visual-studio-code-debugger-error-could-not-find-the-task-gcc-build-active-f

In your task.json file, no task is labeled as ‘gcc build active file’ which is required as a preLaunchTask in launch.json file.

So you can either change the label of task or change the content of preLaunchTask to make them match.

The answer is clear: task.json file this configuration

"label": "C/C++: g++ Generate activity files",

This configuration must be the same as launch. JSON

"preLaunchTask": "g++ build active file",

Solution:

Configure task.json as follows:

"label": "C/C++: g++ Generate activity files",

To be amended as follows:

"label": "g++ build active file",

—————————The following can be ignored———————————-

As long as the two values are the same. You can be like this: (yes, that’s what I changed it to.)

"label": "g++ build active file  hahaha",

NPM start project error: cannot find module ‘webpack’ problem solution

First install cnpm and then use cnpm i to install the package when stuck and then force to end the download and then install node_modules again after the error error, start the project when npm run serve reported the following error.
The correct approach: If you force to interrupt the download, you should remove the node_modules and reinstall them, no error after the end of the installation means success
PS D:\code\DA_svn\pages\index> npm run serve
> [email protected] serve D:\code\DA_svn\pages\index
vue-cli-service serve
INFO  Starting development server…
ERROR  Error: Cannot find module ‘webpack’
Require stack:
– D:\code\DA_svn\pages\index\node_modules\[email protected]@webpack-dev-server\lib\Server.js
– D:\code\DA_svn\pages\index\node_modules\_@[email protected]@@vue\cli-service\lib\commands\serve.js
– D:\code\DA_svn\pages\index\node_modules\_@[email protected]@@vue\cli-service\lib\Service.js
– D:\code\DA_svn\pages\index\node_modules\_@[email protected]@@vue\cli-service\bin\vue-cli-service.js
Error: Cannot find module ‘webpack’
Require stack:
– D:\code\DA_svn\pages\index\node_modules\[email protected]@webpack-dev-server\lib\Server.js
– D:\code\DA_svn\pages\index\node_modules\_@[email protected]@@vue\cli-service\lib\commands\serve.js
– D:\code\DA_svn\pages\index\node_modules\_@[email protected]@@vue\cli-service\lib\Service.js
– D:\code\DA_svn\pages\index\node_modules\_@[email protected]@@vue\cli-service\bin\vue-cli-service.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
at Function.Module._load (internal/modules/cjs/loader.js:687:27)
at Module.require (internal/modules/cjs/loader.js:849:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Module._compile (internal/modules/cjs/loader.js:956:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
at Module.load (internal/modules/cjs/loader.js:812:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:849:19)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\pactera\AppData\Roaming\npm-cache\_logs\2021-03-09T00_59_46_004Z-debug.log

Vscode setting console. Log () shortcut method

Console.log is a very frequently used code in our daily front-end development, so how can we quickly type it in the vscode Compiler. In fact, it’s very simple, just two steps:

1. Open the file in vscode → preferences → user code fragment → search JavaScript in the search box and select JavaScript. JSON 2. Then we can open the key comment code in it

  After opening, you can modify the code appropriately to see your personal habits

After saving, see the effect:

  The effect of carriage return is as follows:

If you continue to use log as the keyword, choose the one in the figure below, otherwise console. Log () will not be displayed

 

Vscode error: error: read etimedout

 

 

Recently, I was working on a “body test” project of the company. When I started ide vscode, I reported an error as follows:

 

 

Error: read ETIMEDOUT 
   at _ errnoException ( util.js:1022 :11) 
   at TLSWrap.onread ( net.js:628 :25)

 

 

And this:

 

 

 

Then I went to the Internet to find a solution, and found the following solution (it didn’t solve my problem, but it’s a good method. Maybe it can solve your problem, so I stuck it. Here’s an explanation)

 

 

Now I’ll talk about the specific commands that need to be executed under the terminal

1. Install cli proxy plugin

npm install -g @ionic/cli-plugin-proxy

2. Configure proxy

export HTTP_PROXY="http://127.0.0.1:51481" # also used by npm
export HTTPS_PROXY="https://127.0.0.1:51481" # also used by npm
export IONIC_HTTP_PROXY="http://127.0.0.1:51481"

Among them, 127.0.0.1:51481 is my own agent

3. Install ionic template

After successfully performing the above two steps, we can download the ionic template

ionic start ionicProject blank

 

 

This is a solution found on the Internet. The way to solve my problem is to set the firewall to stop blocking“ node.js ”It's very simple. Ha ha.

 

There are two solutions in total. If you encounter this problem, I suggest you take a look at the firewall first. If you are not sure, you can use the above method, which should be able to solve the problem. If not, then I can't help it. I can only continue to look for other solutions on the Internet.

 

 

 

WeChat official account: "meet Wang Chuan"

Programming, financial management, English, welcome to play with me.

 

 

 

Vscode code block / full text collapse / expand shortcut

Requirements & amp; operations

There are two types of scenes commonly used (pay attention to the scope of operation):

To operate all code blocks in the file where the cursor is located:

Collapse all Ctrl + K + 0 expand all Ctrl + K + J just operate the code in the code block where the cursor is located:

Collapse Ctrl + Shift + [ Expand Ctrl + Shift +]

More operations

If you have more needs, you can use Ctrl + Shift + P to search fold and unfold for more options.
The following commands can be used to find, do not have to remember (but the above two are still necessary to be familiar with).

Unfold - unfold

Fold - fold