Posts

Showing posts with the label Visual Studio Code

Auto Activate Virtual Environment In Visual Studio Code

Answer : You don't need this line at all. Just remove it and switch your Python interpreter to point to the one within your venv . Here's a relevant documentation (italicized emphasis mine): To select a specific environment, use the Python: Select Interpreter command from the Command Palette ( Ctrl + Shift + P ). ... and opening a terminal with the Terminal: Create New Integrated Terminal command. In the latter case, VS Code automatically activated the selected environment. Once you switch the interpreter VS code should create a .vscode folder within your workspace with a settings.json indicating the python interpreter. This will give VS code the direction of where to locate the venv . This is how I did it in 2021: Enter Ctrl + Shift + P in your vs code. Locate your Virtual Environment: Python: select interpreter > Enter interpreter path > Find Once you locate your virtual env select your python version: your-virtual-env > b...

Can't Push Refs To Remote Try Running Pull First To Integrate Your Changes

Answer : You get this try running pull first to integrate your changes whenever your local branch and your remote branch are not on the same point, before your changes. remote branch commits : A -> B -> C -> D local branch commits : A -> B -> C -> Local_Commits Now clearly, there's a change D that you don't have integrated locally. So you need to rebase , then push, which will lead to the following. remote branch commits : A -> B -> C -> D local branch commits : A -> B -> C -> D -> Local_Commits To solve your issue, do the following git pull --rebase origin branchname git push origin branchname I was getting this message in my Azure DevOps Repos environment because the server had a branch policy on the master branch that requires pull request approval and I was trying to push to master directly. Even after pull and rebase the same message appears. I don't think VS Code really knows how to interpret this specific err...

Are There Bookmarks In Visual Studio Code?

Image
Answer : Yes, via extensions. Try Bookmarks extension on marketplace.visualstudio.com Hit Ctrl + Shift + P and type the install extensions and press enter, then type Bookmark and press enter. Next you may wish to customize what keys are used to make a bookmark and move to it. For that see this question. You need to do this via an extension as of the version 1.8.1. Go to View → Extensions . This will open Extensions Panel. Type bookmark to list all related extensions. Install I personally like "Numbered Bookmarks" - it is pretty simple and powerful. Go to the line you need to create a bookmark. Click Ctrl + Shift + [some number] Ex: Ctrl + Shift + 2 Now you can jump to this line from anywhere by pressing Ctrl + number Ex: Ctrl + 2 Visual Studio Code currently does not support bookmarks natively. Please add this as feature request to our Git Hub issue list (https://github.com/Microsoft/vscode). In the meantime there are some ways to navi...

"Cannot Find Debug Adapter For Type 'node'. "

Answer : I had to restart vscode. Not sure if it's connected but my app crashed because of JavaScript heap out of memory error. Just install the older 'Node Debug' version from the VSC market place. In my case 1.33 did n't and 1.31 works. To debug node js on vs-code two extensions are required. Node Debug Node Debug(legacy) install or enable both and reload. reason for requiring both mentioned here "Node Debug (legacy)" is important because it delegates to "Node Debug" for Node.js versions >= 8.0. Without "Node Debug (legacy)" node debugging is basically disabled because nobody will delegate.

Can't Zoom Out In Visual Studio Code

Answer : On-Screen keyboard did not work for me. But managed to click the reset zoom setting under View>Appearance>Reset Zoom. Zoom Out option was not working. However, Zoom was reset after clicking Reset Zoom option. Found the solution by opening the on-screen keyboard, activating the numeric pad, and using its - . The - is not working on my laptop. On my installation the keyboard shortcuts are working as stated in documentation ( CTRL + - ). For a workaround you can perhaps use the menu items under View > Zoom Out as also written in documentation in Chapter Zoom.

Can't Debug Current Typescript File In VS Code Because Corresponding JavaScript Cannot Be Found

Answer : The problem may be with your map files and not with configuration. Before trying anything else you want to make sure your paths that you are using in your launch configuration are correct. You can do so by substituting the paths with absolute paths on your system temporarily to see if it works. If it does not work you should: Check your tsconfig and make sure mapRoot under compilerOptions is not set to anything. This is what official documentation has to say about it: Specifies the location where debugger should locate map files instead of generated locations. Use this flag if the .map files will be located at run-time in a different location than the .js files. The location specified will be embedded in the sourceMap to direct the debugger where the map files will be located. You can read more about it here In most of the cases, you don't really want to set it to anything. Also, make sure that "sourceMap" : true` is set in co...

Cannot Debug In VS Code By Attaching To Chrome

Answer : You need to install Debugger for Chrome extension for this to work. Open extensions in VS Code and search for Debugger for Chrome You need to run a web server on the URL specified in the first configuration (default to http://localhost:8080). I use serve npm package that I installed globally. From my app folder I run serve -p 8080 Select Launch Chrome against localhost option. It will launch the browser and you can set breakpoints in your code and the debugging should work. Regarding the second configuration (Attach to Chrome). There's nothing special about the port. In order to attach to Chrome you need to run Chrome with remote debugging enabled on port specified in the config. For example chrome.exe --remote-debugging-port=9222 . I personally never use this options. Just follow the three steps above and you should be fine. When using the configuration url , vscode will search for a tab with the EXACT url and attach to it if found. Use the configuration urlFi...