Skip to content
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

Root path suport #22

Open
allangomes opened this issue Nov 30, 2016 · 4 comments
Open

Root path suport #22

allangomes opened this issue Nov 30, 2016 · 4 comments

Comments

@allangomes
Copy link

allangomes commented Nov 30, 2016

.
├── package.json
├── Lib
│   ├── Components
│   └── ...
├── App
│   ├── Customer
│   └── ...

utils

import { List }  from 'Components'

app

import { Customer }  from '~/Customer'

Workspace Settings

{
    "npmintelisense.paths": [
             "./node_modules", 
             "./Lib", 
             { "prefix": "~/",  "path":"./App" }
    ]
}

where . is path of Package.json

@vasa-chi
Copy link

Given facebook/create-react-app#1065 this feature would be indeed awesome.

@mkg0
Copy link

mkg0 commented Feb 10, 2017

i think specific path options are welcome but vscode uses jsconfig.json file for resolving modules like this:

// jsconfig.json
{
    "compilerOptions": {
        "target": "ES6",
        "module": "commonjs",
        "allowSyntheticDefaultImports": true,
        "baseUrl": "./",
        "paths": {
          "~/*": "App/*",
          "*": [
              "Lib/*",
          ]
        }
    }
}

microsoft/vscode#14907 (comment)

it is better supporting default resolver. herewith we can peek or goto directly modules by clicking.

( also jsconfig.json schema: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/jsconfig.json )

@alvelig
Copy link

alvelig commented Feb 18, 2017

I would suggest that import '/components' referred to import '{rootPath}/src/components' by default.

For now ejected and use .babelrc:

{
  "plugins": [
    ["babel-root-slash-import", {
      "rootPathSuffix": "src"
    }]
  ]
}

This is fully compatible with Intellij Idea and as far as I can see does not interfere with other ways of defining absolute or relative paths.

@Ronsku
Copy link

Ronsku commented May 12, 2017

I would also like to have intellisense for typescript custom paths that are generated in the tsconfig.json like this:

{
  "compileOnSave": false,
  "compilerOptions": {
    "paths": {
      "@app/*": ["./app/*"],
      "@src/*": ["./*"]
    },
  ...

Usage for example:
import { RootReducer } from '@app/app.reducers'; // This provides currently no path intellisense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants