Also, ensure that passing an item that is not yet present in the
workspace does not interfere with resolving the location where we want
to place the item.
Many packages currently use this instance variable instead of calling
`Package.prototype.getMainModulePath`. With this commit we will eagerly
compute it for preloaded packages too and therefore prevent third party
packages that rely on this implementation detail from breaking.
This commit changes the behavior of `open()` so that the item will be
added to the workspace—even if the `activateItem` option is false.
This provides a way to open (and add) an item without activating it,
but removes the ability to open without adding. For that, we've made
the `createItemForURI()` method public 😊
This adds an method for hiding items by URI and re-implements
`toggle()` in terms of it. (tbh it's really just extracting most of
`toggle()` into a new function.)
This module uses Node's `path` for determinining which path separator to
use on the current platform. On browsers (and every other environment
that does not support `require`, such as v8 snapshots) it falls back to
always using a forward slash.
As a result, `PackageTranspilationRegistry` (and potentially other
bundled packages that depend on `minimatch`) couldn't match glob
expressions against any given path on Windows, thus causing the custom
transpiler code to not work properly.
This ensures that the function always behaves asynchronously regardless
of the state of the workspace.
/cc @maxbrunsfeld
Signed-off-by: Antonio Scandurra <as-cii@github.com>
We thought it was a bug that activateItem: false caused the
item not to be added, but it turned out there were package
tests that depended on this behavior.
Ideally, we should have an addItem option that exhibits this
behavior instead.
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
This will reuse the information that comes from `getAvailablePackages`,
thus avoiding to resolve, for example, a package path twice.
`PackageManager.loadPackage` will still be supported for backward
compatibility, but it will use `loadAvailablePackage` under the hood.