Skip to content

Peek Definition in custom location #11959

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
waderyan opened this issue Oct 31, 2016 · 11 comments
Closed

Peek Definition in custom location #11959

waderyan opened this issue Oct 31, 2016 · 11 comments
Labels
Question An issue which isn't directly actionable in code VS Code Tracked There is a VS Code equivalent to this issue

Comments

@waderyan
Copy link

From @vvatikiotis on October 21, 2016 6:48

  • VSCode Version: 1.6.1
  • OS Version: OS X 10.11.6

Is it possible to configure VSS, (via jsoncifg.json maybe?) to Peek Definition inside custom project locations? For instance:

import { read, update, getTokenFromState } from 'utils/xhr'

Currently, I'm unable to Peek Definition in location utils/xhr, which specifies a project-wise absolute location. This works for relative locations.

Thanks

Copied from original issue: microsoft/vscode#14134

@waderyan waderyan self-assigned this Oct 31, 2016
@waderyan
Copy link
Author

From @roblourens on October 21, 2016 18:7

How does it resolve an import path like that? Do you get intellisense for those imports?

@waderyan
Copy link
Author

From @vvatikiotis on October 23, 2016 10:56

  • Paths like this are located under project-root/src. So, ideally, I'd like to be able to specify src/ (or any other directory under project-root) as a "resolve-root", so anything under it would resolve correctly.
  • I do get intellisense for these imports.

@waderyan
Copy link
Author

From @roblourens on October 23, 2016 17:14

And you're saying that you can't do go to definition/peek definition for read or other things imported from a path like that?

@waderyan
Copy link
Author

From @vvatikiotis on October 23, 2016 17:19

Yes

@waderyan
Copy link
Author

@vvatikiotis What you are describing is a bug and not intended behavior. Can you share your workspace or a minimal repo that reproduces the behavior? I am not seeing this in the latest Insiders build.

@waderyan
Copy link
Author

From @vvatikiotis on October 25, 2016 6:54

Try react-redux-starter-kit. In lines 18-19 in build/webpack.config.js, a few paths are resolved, so, inside the project, locations such as routes/Counter/containers/CounterContainer can be used. Webpack will resolve those and for this example will lookup CounterContainer.js under the correct path src/routes/Counter/containers/CounterContainer.

That was my original question, i.e. is it possible to specify project locations in VSS, such as src/, so all files under these locations can be Peeked when imported as

routes/Counter/containers/CounterContainer,

instead of

src/routes/Counter/containers/CounterContainer?

@waderyan
Copy link
Author

@vvatikiotis thank you for the explanation. This is a unique feature request. The functionality for this depends on the JavaScript language service which is contained in the TypeScript repo. Migrating there.

@waderyan waderyan added VS Code Tracked There is a VS Code equivalent to this issue and removed typescript labels Oct 31, 2016
@waderyan waderyan removed their assignment Oct 31, 2016
@waderyan
Copy link
Author

waderyan commented Oct 31, 2016

@bowdenk7 do you have a feature request like this on your roadmap or radar as a duplicate issue? I have not seen it before.

@mhegazy
Copy link
Contributor

mhegazy commented Oct 31, 2016

The config file should support baseUrl and paths propeoteis to allow you to map modules to thier location.. for instance:

"compilerOptions": {
   "baseUrl": "./modules"
}

Tells the system to look for utils/xhr under ./modules/utils/xhr

similarally:

"compilerOptions": {
   "baseUrl": "./modules",
   "paths": {
        "utils/xhr" : [ "xhr"]
   }
}

Tells the system to look for utils/xhr under ./modules/xhr

you can find more about this in http://www.typescriptlang.org/docs/handbook/module-resolution.html#additional-module-resolution-flags

@mhegazy mhegazy added the Question An issue which isn't directly actionable in code label Oct 31, 2016
@mhegazy mhegazy closed this as completed Oct 31, 2016
@vvatikiotis
Copy link

Thanks for the reply, this resolves my issue, specifying baseUrl inside compilerOptions in jsconfig.json` allows me to Peek inside said imports.

One minor glitch: in jsconfig.json, VSS green underlines the baseUrl property; the showHover command shows the message "Property baseUrl is not allowed".

@mhegazy
Copy link
Contributor

mhegazy commented Oct 31, 2016

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Question An issue which isn't directly actionable in code VS Code Tracked There is a VS Code equivalent to this issue
Projects
None yet
Development

No branches or pull requests

3 participants