Skip to content

Conversation

mhegazy
Copy link
Contributor

@mhegazy mhegazy commented Aug 1, 2014

There are some changes in behavior between old and new implementation, namely:

  • module definition used to start at the module name, now it starts the module keyword, which is uniform with other constructs
  • Goto def on function call used to take you to the matching signature instead of the definition, now it is always the definition
  • new implementation support goto def on labels
  • new implementation support goto def on string property names (e.g. a["prop"])
  • new implementation support goto def on /// references

case SyntaxKind.ArrowFunction:
case SyntaxKind.ModuleDeclaration:
case SyntaxKind.ClassDeclaration:
// Label targets can not be accorss function boundries, so do not walk any further
Copy link
Contributor

Choose a reason for hiding this comment

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

"across" and "boundaries"

Copy link
Contributor

Choose a reason for hiding this comment

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

We should still cross function boundaries. The compiler already binds them in this manner (and then reports you have an error if it crossed a boundary). This way, one can still do goto-def (esp. after getting that error).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point. will change it.

var type = symbol && typeChecker.getTypeOfSymbol(symbol);
if (type) {
return {
memberName: new TypeScript.MemberNameString(typeChecker.typeToString(type)),
Copy link
Member

Choose a reason for hiding this comment

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

Don't you need the type name in the containeNode context eg. qualifying typeof expression?

* documentsByName to sourceFilesByName
* getSymbolOfIdentifierLikeNode to getSymbolInfo

var declarations = symbol.getDeclarations();
var symbolName = typeChecker.symbolToString(symbol, node);
var symbolKind = getSymbolKind(symbol);
Copy link
Member

Choose a reason for hiding this comment

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

Why is symbolKind based on symbol and not declaration? eg. if it is fundule you want the 2 definitions with the correct function and module declaration kind?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cause I was just lazy.. will fix that a different change.

@mhegazy
Copy link
Contributor Author

mhegazy commented Aug 4, 2014

@sheetalkamat, @vladima and @DanielRosenwasser any more comments?

return true;
}

return false
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing semicolon

@sheetalkamat
Copy link
Member

👍

mhegazy added a commit that referenced this pull request Aug 4, 2014
Wire getDefinitionAtPosition using the new compiler implementation
@mhegazy mhegazy merged commit ab05b75 into master Aug 4, 2014
@mhegazy mhegazy deleted the getDefinition branch August 4, 2014 22:12
@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants