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(completion): no space after cursor #119

Merged
merged 8 commits into from
Jan 10, 2025

Conversation

qvalentin
Copy link
Collaborator

@qvalentin qvalentin commented Nov 19, 2024

@qvalentin
Copy link
Collaborator Author

@CodiumAI-Agent /review

@CodiumAI-Agent
Copy link

CodiumAI-Agent commented Nov 29, 2024

PR Reviewer Guide 🔍

(Review updated until commit c0f1c77)

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis ✅

118 - Fully compliant

Fully compliant requirements:

  • Fix inconsistent auto-completion behavior in NeoVim when editing existing template keys.
  • Ensure .Values. and .Values.f provide correct completions in all contexts.
  • Add relevant tests to validate the fix.

Not compliant requirements:

⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Possible Issue

The function NestedNodeAtPositionForCompletion modifies the logic for determining the current node and its children. Ensure that this change does not introduce regressions in other parts of the codebase that rely on this function.

func NestedNodeAtPositionForCompletion(tree *sitter.Tree, position lsp.Position) *sitter.Node {
	pointToLookUp := sitter.Point{
		Row:    position.Line,
		Column: position.Character - 1,
	}
	currentNode := tree.RootNode().NamedDescendantForPointRange(pointToLookUp, pointToLookUp)
	return FindRelevantChildNodeCompletion(currentNode, pointToLookUp)
Logic Change

The handling of NodeTypeDotSymbol and NodeTypeSelectorExpression has been updated. Verify that these changes correctly address the ticket requirements without breaking existing functionality.

case gotemplate.NodeTypeDotSymbol:
	// DotSymbol appears inside a SelectorExpression or at the end of an UnfinishedSelectorExpression
	v.symbolTable.AddTemplateContext(append(v.currentContext, ""), GetRangeForNode(node))
case gotemplate.NodeTypeFieldIdentifier:
	content := node.Content(v.content)
	v.symbolTable.AddTemplateContext(append(v.currentContext, content), GetRangeForNode(node))
case gotemplate.NodeTypeField:
	content := node.ChildByFieldName("name").Content(v.content)
	v.symbolTable.AddTemplateContext(append(v.currentContext, content), GetRangeForNode(node.ChildByFieldName("name")))
case gotemplate.NodeTypeSelectorExpression:
	operandNode := node.ChildByFieldName("operand")
	if operandNode != nil && operandNode.Type() == gotemplate.NodeTypeVariable {
		v.StashContext()
		v.PushContext(operandNode.Content(v.content))
	}

@qvalentin qvalentin marked this pull request as ready for review January 10, 2025 19:39
@qvalentin qvalentin force-pushed the fix/completion-without-space-after-cursor branch from 2c5d440 to c0f1c77 Compare January 10, 2025 19:45
@qvalentin qvalentin merged commit a0391b4 into master Jan 10, 2025
4 checks passed
@CodiumAI-Agent
Copy link

Persistent review updated to latest commit c0f1c77

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.

2 participants