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

How to get folderpath name of currently opened file in visual studio code

$
0
0

I have opened multiple angular projects in visual studio code and i am trying to get cuttenlty opened file's project folder path inside my extension. But I am not getting the correct path . Anyone know please help to find the solution.

Below script only will work if I open single angular project in VS Code but how do for if I open multiple project folders.

extension.js:

exports.activate = context => {
const mymodules = vscode.commands.registerCommand('extension.search', () => {

var rooturi = vscode.workspace.workspaceFolders[0].uri;
var folderpathnameofcurrentlyopenedfile=rooturi.fsPath;  // currently opened file's project folder path[Opened single project]

Viewing all articles
Browse latest Browse all 99733

Trending Articles



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