How to get my angular project folder path in VS code extension.js.I tried but not working. Example my angular project name "universe" and "bookworld" I opened in visual studio code.
universe - project folder name
-e2e
-node_modules
-src
-angular.json
-package.json
-package-lock.json
-README
-tsconfig.json
-tslint.json
bookworld - project folder name
-e2e
-node_modules
-src
-angular.json
-package.json
-package-lock.json
-README
-tsconfig.json
-tslint.json
extension.js:
const vscode = require('vscode');
const path = require('path');
function activate(context) {
const fullPath = path.dirname("c://mamp/htdocs/projects/ps/src/app/app.component.html");
const regexResp = /^(.*?)node_modules/.exec(fullPath);
const nodemodulesPath = regexResp ? regexResp[1] : fullPath;
console.log(nodemodulesPath );
//Example if i open package.json from universe in vs code project output should be like var currentprojectfolderpath =c://mamp/htdocs/main/universe
//Example if i open tslint.json from universe project in vs code output should be like var currentprojectfolderpath =c://mamp/htdocs/main/bookworld
}
How can I get currently opened file's project folder path?