jasonnutter / vscode-search-node-modules

Simple plugin for VS Code that allows you to quickly navigate the file inside your project's node_modules directory.
https://marketplace.visualstudio.com/items?itemName=jasonnutter.search-node-modules
MIT License
60 stars 17 forks source link

How to search node modules in one step back parent folder #23

Open SaranSank opened 5 years ago

SaranSank commented 5 years ago

Hi, Currently we can search only node modules in workspaceFolder but how we can search in parent folder..where i want to change in extension.js? My project folder structure :

http://localhost/projects/mynodemodules/myproject

mynodemodules->folder [ http://localhost/projects/mynodemodules/ ]

deadcoder0904 commented 5 years ago

I am facing a similar issue.

I have the following structure ⸺

- root/
     - project/
         - index.js
         - package.json
         - node_modules
     - README.md

I have opened root/ folder in VSCode & I entered Search node_modules in search. It threw an error Search node_modules: No node_modules folder in this workspace.

Any ideas to solve this?

SaranSank commented 5 years ago

@deadcoder0904 : We can resolve easy,

getWorkspaceFolder().then(folder => folder && getProjectFolder(folder)).then(folder => { if (folder) { var f_path = path.join(folder.path, '../'); searchPath(folder.name, f_path, modulesPath); } });

deadcoder0904 commented 5 years ago

@SaranSank PR might be more helpful :)

SaranSank commented 5 years ago

@deadcoder0904 : You are from india? You well in nodejs?

deadcoder0904 commented 5 years ago

Yeah

SaranSank commented 5 years ago

I have one doubt in nodjs. How to read dir from server path. Example

var f_path = "http://hostname.com/ac/projects/nodepackages"; searchPath(folder.name, f_path, modulesPath);

deadcoder0904 commented 5 years ago

You should ask such questions on StackOverflow. Never spam an issue.

But to answer your question, that is not the correct way unless your host is publicly accessible. Do it just as you do locally & then push to server & it should work.

SaranSank commented 5 years ago

I did in locally.But not working for server url. I have asked in stackOverflow but no answer

deadcoder0904 commented 5 years ago

Try posting on reddit.com/r/nodejs

SaranSank commented 5 years ago

If you do not mind can you send me ur email id or any other mode to contact. That is very usefull to contact you. Here we can not discuss more

SaranSank commented 5 years ago

@deadcoder0904 : Are you there?