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

fix: autocomplete supports adding extensions #156

Merged
merged 4 commits into from
Aug 28, 2020

Conversation

axetroy
Copy link
Contributor

@axetroy axetroy commented Aug 27, 2020

close #138

Typescript does not add extensions by default for cached modules when import from autocomplete

- import { foo } from "./bar"
+ import { foo } from "./bar.ts"

Now it has been fixed

/cc @ry @bartlomieju

before

2

after

1

 PASS  core/deno_normalize_import_statement.test.ts
 PASS  core/deno_deps.test.ts
 PASS  core/deno_type_hint.test.ts
 PASS  core/cache.test.ts
 PASS  core/import_map.test.ts
 PASS  core/module_resolver.test.ts
 PASS  core/cache_map.test.ts
 PASS  core/file_walker.test.ts
 PASS  core/extension.test.ts
 PASS  core/configuration.test.ts
 PASS  core/deno_cache.test.ts
 PASS  core/deno.test.ts
 PASS  core/util.test.ts
 PASS  core/hash_meta.test.ts
------------------------------------|---------|----------|---------|---------|-------------------
File                                | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
------------------------------------|---------|----------|---------|---------|-------------------
All files                           |     100 |      100 |     100 |     100 |                   
 cache.ts                           |     100 |      100 |     100 |     100 |                   
 cache_map.ts                       |     100 |      100 |     100 |     100 |                   
 configuration.ts                   |     100 |      100 |     100 |     100 |                   
 deno.ts                            |     100 |      100 |     100 |     100 |                   
 deno_cache.ts                      |     100 |      100 |     100 |     100 |                   
 deno_deps.ts                       |     100 |      100 |     100 |     100 |                   
 deno_normalize_import_statement.ts |     100 |      100 |     100 |     100 |                   
 deno_type_hint.ts                  |     100 |      100 |     100 |     100 |                   
 extension.ts                       |     100 |      100 |     100 |     100 |                   
 file_walker.ts                     |     100 |      100 |     100 |     100 |                   
 hash_meta.ts                       |     100 |      100 |     100 |     100 |                   
 import_map.ts                      |     100 |      100 |     100 |     100 |                   
 module_resolver.ts                 |     100 |      100 |     100 |     100 |                   
 util.ts                            |     100 |      100 |     100 |     100 |                   
------------------------------------|---------|----------|---------|---------|-------------------

return;
}

const denoSupportedExtensions = [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we cannot know the actual module from import { foo } from "./bar"

So we can only guess based on commonly used extensions until they match

Copy link
Member

@lucacasonato lucacasonato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @axetroy - this is a very nice addition. I tested it locally and it works exactly as expected 👍

core/util.ts Outdated Show resolved Hide resolved
Copy link
Member

@lucacasonato lucacasonato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks @axetroy!

@lucacasonato lucacasonato merged commit 1326b18 into denoland:master Aug 28, 2020
@axetroy axetroy deleted the fix branch August 28, 2020 09:12
axetroy added a commit to axetroy/vscode_deno that referenced this pull request Sep 5, 2020
CGQAQ pushed a commit to CGQAQ/vscode_deno that referenced this pull request Sep 13, 2020
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

Successfully merging this pull request may close these issues.

Auto-Add Suffix To Import
2 participants