-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Support module specifiers with extensions in editors #920
Comments
Other solution: become popular and force the eco system to support us. |
@ry Re: forcing the eco system to support us - I already started myself ;) few weeks ago I posted a comment about it in a related issue in the TypeScript repo, just so that people know that the current behaviour and syntax highlighting is completely backwards for some runtimes like Deno - Code highlights good code as error and bad code as ok: I'm sure that eventually the editors will support Deno like they support Node today but I'd like it to happen sooner rather than later, so the more people are vocal about it the better. |
FWIW SystemJS 2.0 no longer adds extensions by default to make build
tooling adapt to this instead of the other way around.
…On Thu, 11 Oct 2018 at 09:26, Rafał Pocztarski ***@***.***> wrote:
@ry <https://github.com/ry> Re: forcing the eco system to support us - I
already started myself ;) few weeks ago I posted a comment about it in a
related issue in the TypeScript repo, just so that people know that the
current behaviour and syntax highlighting is completely backwards for some
runtimes like Deno - Code highlights good code as error and bad code as ok:
- microsoft/TypeScript#11235 (comment)
<microsoft/TypeScript#11235 (comment)>
I'm sure that eventually the editors will support Deno like they support
Node today but I'd like it to happen sooner rather than later, so the more
people are vocal about it the better.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#920 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAkiyunNTocnbgMYdXBSDVIxqmvD5qPKks5uj3EngaJpZM4XK8wR>
.
|
@guybedford that's good news. I never really understood why transpilers couldn't change the extensions in the first place since they know what they are transpiling anyway (and since I see in https://github.com/systemjs/systemjs/blob/2.0.0/docs/system-register.md examples like:
so if it's valid in Deno and SystemJS then I guess VS Code and others will follow, hopefully sooner rather than later. Update: It turns out that VS Code considers js extensions to be fine, only ts extensions to be errors, which is even more confusing than I thought before - see this comment microsoft/TypeScript#11235 (comment) |
Well, it is sort of simple from the TypeScript perspective, Because we have the extensionless at the moment, and Node.js is considering changing their module resolution, my opinion is we wait a bit longer and if push comes to shove, I suspect we could submit a PR that meets our needs and champion for it with the core TypeScript team. |
@kitsonk is this issue somehow resolved with your deno_ls_plugin? |
Yes and the VScode plugin. |
Mostly this is for tracking purposes.
Currently the TypeScript language services module specifier resolution does not allow extensions as part of the module specifier. The TypeScript team's main argument is that all the main module loaders (AMD, CommonJS, SystemJS and native browser module loaders) support extensionless module resolution and has been the common standard. Add to that the TypeScript is generally a transpiled language means that a module specifier of
foo/bar.ts
would need to be rewritten tofoo/bar.js
or maybefoo/bar.mjs
orfoo/bar.ejs
or anything really after transpilation and rewriting module specifiers is a really loaded and complex topic.@guybedford indicated that Node.js is considering supporting full extension module resolution. I suspect if that is the case, TypeScript would need to reflect that, but that would complicate what needs to be done at design time and what would be reality at run time. It will simply be complicated.
The other challenge that Deno has, is that even if there was a default module resolution with extensions in TypeScript, it is very unlikely that it would support fetching the types of remote modules for consumption in the editor. So while local modules would have type information, remote one would simply be unresolvable.
The only long term solution I see is that there is a language services plugin for Deno, that would provide a different wrap to the language services API for standard TypeScript, that would do the following things:
The text was updated successfully, but these errors were encountered: