PathIntellisense: path-intellisense.mappings doesn't work / not used correctly
i tried using that to solve my webpack absolute pathto autocomplete modules.
- The projects sits on
/Users/myuser/Workspace/foo. - The directory that I want to autocomplete is
/Users/myuser/Workspace/foo/src. - I want to use it on my code so I can write in a file:
import Bar from 'utils/bar'
and it will be resolved to: /Users/myuser/Workspace/foo/src/utils/bar.
I tried as above:
"path-intellisense.mappings": {
"/": "${workspaceRoot}/src"
}
what am i doing wrong ?
also - my src folder contains 10 directories that I want to be auto-mapped… do I have to add a record for each of them or it will be auto-mapped ?
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 15
- Comments: 33 (3 by maintainers)
Commits related to this issue
- Improve absolute path handling (mostly-Windows fixes, some QOL) - Fixes (#48, #157) - Potentially fixes (#51) - Adds 'absolutePathTo' setting, a more flexible absolutePathToWorkspace - Adds 'showOnAbs... — committed to jheiv/PathIntellisense by jheiv 2 years ago
- fix: Improve absolute path handling (mostly-Windows fixes, some QOL) (#193) - Fixes (#48, #157) - Potentially fixes (#51) - Adds 'absolutePathTo' setting, a more flexible absolutePathToWorkspace -... — committed to ChristianKohler/PathIntellisense by jheiv 2 years ago
- chore(release): 2.6.1 [skip ci] ## [2.6.1](https://github.com/ChristianKohler/PathIntellisense/compare/v2.6.0...v2.6.1) (2022-01-14) ### Bug Fixes * Improve absolute path handling (mostly-Windows f... — committed to ChristianKohler/PathIntellisense by semantic-release-bot 2 years ago
@ChristianKohler i figured out that you can reproduce this issue by installing both
path-intellisenseandnpm-intellisense.I think the problem comes from
npm-IntelliSenseIt seems that vscode’s import path quick suggestions break mappings After I added
and with
it started to provide correct suggestions for
import from '@/'having this issue without npm-intellisense installed
absolute mapping is not working either for me. Don’t have npm intellisense extension…
Disable npm intellisense extension and add
it works for me now
Got the same issue.
Here is my config:
When I use it with elements’ attrs it works
It also works with exports
But the only thing I need to be work – doesn’t work 😃
same here: trying to map my
app/directory to be used without prefix in my code:both
import '/'andimport ''don’t provide suggestionsmappings not work if npm-intellisense installed
@lucasbento I am sorry. I don’t mean to order anyone to do anything. My words are inappropriate.
@ChristianKohler as you said. It is work. But is not similar behaviour as how alias in webpack work. for example.
I expect
"*": "${workspaceRoot}/main/src"instead of"components": "${workspaceRoot}/main/src/components"Then I can type whatever
import x from componentsorimport y from containers. In your case. Should I need to keep maintain project structure?same issue and npm-intellisense isn’t installed and there is no such thing as

typescript.quickSuggestionsForPaths.have anyone got any success on this ?
I got mine to work by disabling a few default path suggestions
Depending on which language you are working in you may have to disable the default setting
{language}.suggest.pathsYou can make the settings specific only to a workspace which makes it more convenient.I didn’t need to disable any other extension.
I’ve uninstalled npm-intellisense and getting same error