-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Find All Reference from requiring file to module file works only if not default CommonJS exports #22222
Comments
The bug here is that find all references shows the
this makes sense, since you are referencing a property on the module. |
In case SyntaxKind.VariableDeclaration:
return { isNamedImport: false }; But then it fails at I tested with: /// <reference path='fourslash.ts'/>
// @allowJs: true
// @Filename: /a.ts
////function [|{| "isWriteAccess": true, "isDefinition": true |}x|]() {};
////export = [|x|];
// @Filename: /b.js
////const [|{| "isWriteAccess": true, "isDefinition": true |}x|] = require("./a");
////[|x|];
const [r0, r1, r2, r3] = test.ranges();
verify.referenceGroups(r2, [/*todo*/]); |
The following test cases crashes currently (with no modifications) because of the failure to find a symbol: /// <reference path='fourslash.ts'/>
// @allowJs: true
// @Filename: /a.js
////function [|{| "isWriteAccess": true, "isDefinition": true |}x|]() {};
////module.exports = [|x|];
// @Filename: /b.ts
////import [|{| "isWriteAccess": true, "isDefinition": true |}x|] = require("./a");
////[|x|];
const [r0, r1, r2, r3] = test.ranges();
verify.referenceGroups(r2, [/*todo*/]); |
Does #23570 fix this? It makes module.exports= an alias, just like export= is. |
@sandersn That fixes the second example, but it looks like |
I think fixing #25533 would fix this. |
Typescript behaviour on this front is so broken that it needs to be fixed before fixing Javascript: // @Filename: welove.ts
const g = 4567;
export = g;
// @Filename: app.tsx
import good = require('./welove')
console.log(good/*1*/) Find-all-refs at // @Filename: welove.ts
const g = 4567;
export const good = g;
// @Filename: app.tsx
import { good } from './welove'
console.log(good/*1*/) Here, find-all-refs at (1) finds the last 3 lines, which seems fine. But it does even with the import is This may be fixed in some version of VS but it's broken in VS Code and emacs. I'll see if there's an existing bug. |
From @Hoishin on February 28, 2018 4:58
Might belong to microsoft/vscode#21507, but I thought it is a bit different.
Steps to Reproduce:
module.exports
somethingrequire
itf
inconsole.log
doesn't show references across files in Find All References. You can find references across files if you Find All References from the module file.However,
module.exports.foo
somethingrequire
itfoo
inconsole.log
DOES show reference across files in Find All References. You can find references across files if you Find All References from the module file.Does this issue occur when all extensions are disabled?: Yes
Copied from original issue: microsoft/vscode#44700
The text was updated successfully, but these errors were encountered: