Skip to content

Commit

Permalink
account for vscode ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
jpogran committed Feb 6, 2024
1 parent 3afc4c2 commit 2f9d3a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 1 addition & 2 deletions internal/langserver/handlers/command/module_calls.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/hashicorp/terraform-ls/internal/langserver/cmd"
"github.com/hashicorp/terraform-ls/internal/uri"
tfaddr "github.com/hashicorp/terraform-registry-address"
"github.com/hashicorp/terraform-schema/module"
tfmod "github.com/hashicorp/terraform-schema/module"
)

Expand Down Expand Up @@ -141,7 +140,7 @@ func getModuleType(sourceAddr tfmod.ModuleSourceAddr) ModuleType {
return TFREGISTRY
}

_, ok = sourceAddr.(module.LocalSourceAddr)
_, ok = sourceAddr.(tfmod.LocalSourceAddr)
if ok {
return LOCAL
}
Expand Down
10 changes: 5 additions & 5 deletions internal/langserver/handlers/command/terraform_plan_lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (h *CmdHandler) TerraformPlanLookupHandler(ctx context.Context, args cmd.Co
}

// NOTE: Do not return errors for this handler as this is
// for hyperlinks in a terminal. We would spam the message box
// for hyperlinks in a terminal. We would spam message boxes
// if a user hovered over things that were not valid

// Get the module dir, if it exists
Expand Down Expand Up @@ -68,10 +68,10 @@ func (h *CmdHandler) TerraformPlanLookupHandler(ctx context.Context, args cmd.Co

// TODO: these lines are off because of the drift between
// what terraform plan shows versus what is in the actual file
response.Range.StartLine = target.RangePtr.Start.Line
response.Range.StartCharacter = target.RangePtr.Start.Column
response.Range.EndLine = target.RangePtr.End.Line
response.Range.EndCharacter = target.RangePtr.End.Column
response.Range.StartLine = target.RangePtr.Start.Line-1
response.Range.StartCharacter = target.RangePtr.Start.Column-1
response.Range.EndLine = target.RangePtr.End.Line-1
response.Range.EndCharacter = target.RangePtr.End.Column-1

return response, nil
}
Expand Down

0 comments on commit 2f9d3a6

Please sign in to comment.