Use '~' for user home directory in jsconfig.json in VSCode?

67 views Asked by At

In the includes in my jsconfig.json file, I want to use the tilde character ~ to expand to the current user's home directory, since I work on the same project on multiple computers with different usernames. It seems like the ~ doesn't work, however. Is there an accepted way to do this?

I've tried:

{
  "include": [
    "*.js",
    "**/*.js",
    "~/.vscode/extensions/samplavigne.p5-vscode-1.2.14/p5types/global.d.ts"
  ]
}

Expected to work the same as

{
  "include": [
    "*.js",
    "**/*.js",
    "/Users/mngyuan/.vscode/extensions/samplavigne.p5-vscode-1.2.14/p5types/global.d.ts"
  ]
}

but no typeahead suggestions appear anymore.

1

There are 1 answers

0
starball On

I see this as an XY problem. You can just npm install -D "@types/p5~1.2.14".

And no, I am not aware of a way to refer to abstractly refer to a user's home directory in the include property of a jsconfig.