Skip to content

Commit

Permalink
protocol: Pull in gopls v0.10.0 tsprotocol.go & update references
Browse files Browse the repository at this point in the history
  • Loading branch information
radeksimko committed Apr 24, 2023
1 parent 5ac3113 commit a2210b4
Show file tree
Hide file tree
Showing 13 changed files with 3,393 additions and 4,037 deletions.
100 changes: 0 additions & 100 deletions internal/langserver/handlers/complete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,16 +149,9 @@ func TestModuleCompletion_withValidData_basic(t *testing.T) {
"id": 3,
"result": {
"isIncomplete": false,
"itemDefaults": {
"editRange": {
"start": {"line": 0, "character": 0},
"end": {"line": 0, "character": 0}
}
},
"items": [
{
"label": "alias",
"labelDetails": {},
"kind": 10,
"detail": "optional, string",
"documentation": "Alias for using the same provider with different configurations for different resources, e.g. eu-west",
Expand All @@ -179,7 +172,6 @@ func TestModuleCompletion_withValidData_basic(t *testing.T) {
},
{
"label": "anonymous",
"labelDetails": {},
"kind": 10,
"detail": "optional, number",
"documentation": "Desc 1",
Expand All @@ -200,7 +192,6 @@ func TestModuleCompletion_withValidData_basic(t *testing.T) {
},
{
"label": "base_url",
"labelDetails": {},
"kind": 10,
"detail": "optional, string",
"documentation": "Desc 2",
Expand All @@ -221,7 +212,6 @@ func TestModuleCompletion_withValidData_basic(t *testing.T) {
},
{
"label": "individual",
"labelDetails": {},
"kind": 10,
"detail": "optional, bool",
"documentation": "Desc 3",
Expand All @@ -242,7 +232,6 @@ func TestModuleCompletion_withValidData_basic(t *testing.T) {
},
{
"label": "version",
"labelDetails": {},
"kind": 10,
"detail": "optional, string",
"documentation": "Specifies a version constraint for the provider, e.g. ~\u003e 1.0",
Expand Down Expand Up @@ -353,16 +342,9 @@ func TestModuleCompletion_withValidData_tooOldVersion(t *testing.T) {
"id": 3,
"result": {
"isIncomplete": false,
"itemDefaults": {
"editRange": {
"start": {"line": 0, "character": 0},
"end": {"line": 0, "character": 0}
}
},
"items": [
{
"label": "default",
"labelDetails": {},
"kind": 10,
"detail": "optional, any type",
"documentation": "Default value to use when variable is not explicitly set",
Expand All @@ -383,7 +365,6 @@ func TestModuleCompletion_withValidData_tooOldVersion(t *testing.T) {
},
{
"label": "description",
"labelDetails": {},
"kind": 10,
"detail": "optional, string",
"documentation": "Description to document the purpose of the variable and what value is expected",
Expand All @@ -404,7 +385,6 @@ func TestModuleCompletion_withValidData_tooOldVersion(t *testing.T) {
},
{
"label": "type",
"labelDetails": {},
"kind": 10,
"detail": "optional, type",
"documentation": "Type constraint restricting the type of value to accept, e.g. string or list(string)",
Expand Down Expand Up @@ -515,16 +495,9 @@ func TestModuleCompletion_withValidData_tooNewVersion(t *testing.T) {
"id": 3,
"result": {
"isIncomplete": false,
"itemDefaults": {
"editRange": {
"start": {"line": 0, "character": 0},
"end": {"line": 0, "character": 0}
}
},
"items": [
{
"label": "default",
"labelDetails": {},
"kind": 10,
"detail": "optional, any type",
"documentation": "Default value to use when variable is not explicitly set",
Expand All @@ -545,7 +518,6 @@ func TestModuleCompletion_withValidData_tooNewVersion(t *testing.T) {
},
{
"label": "description",
"labelDetails": {},
"kind": 10,
"detail": "optional, string",
"documentation": "Description to document the purpose of the variable and what value is expected",
Expand All @@ -566,7 +538,6 @@ func TestModuleCompletion_withValidData_tooNewVersion(t *testing.T) {
},
{
"label": "sensitive",
"labelDetails": {},
"kind": 10,
"detail": "optional, bool",
"documentation": "Whether the variable contains sensitive material and should be hidden in the UI",
Expand All @@ -587,7 +558,6 @@ func TestModuleCompletion_withValidData_tooNewVersion(t *testing.T) {
},
{
"label": "type",
"labelDetails": {},
"kind": 10,
"detail": "optional, type",
"documentation": "Type constraint restricting the type of value to accept, e.g. string or list(string)",
Expand All @@ -608,7 +578,6 @@ func TestModuleCompletion_withValidData_tooNewVersion(t *testing.T) {
},
{
"label": "validation",
"labelDetails": {},
"kind": 7,
"detail": "Block",
"documentation": "Custom validation rule to restrict what value is expected for the variable",
Expand Down Expand Up @@ -742,16 +711,9 @@ func TestModuleCompletion_withValidDataAndSnippets(t *testing.T) {
"id": 3,
"result": {
"isIncomplete": false,
"itemDefaults": {
"editRange": {
"start": {"line": 0, "character": 0},
"end": {"line": 0, "character": 0}
}
},
"items": [
{
"label": "alias",
"labelDetails": {},
"kind": 10,
"detail": "optional, string",
"documentation": "Alias for using the same provider with different configurations for different resources, e.g. eu-west",
Expand All @@ -772,7 +734,6 @@ func TestModuleCompletion_withValidDataAndSnippets(t *testing.T) {
},
{
"label": "anonymous",
"labelDetails": {},
"kind": 10,
"detail": "optional, number",
"documentation": "Desc 1",
Expand All @@ -797,7 +758,6 @@ func TestModuleCompletion_withValidDataAndSnippets(t *testing.T) {
},
{
"label": "base_url",
"labelDetails": {},
"kind": 10,
"detail": "optional, string",
"documentation": "Desc 2",
Expand All @@ -822,7 +782,6 @@ func TestModuleCompletion_withValidDataAndSnippets(t *testing.T) {
},
{
"label": "individual",
"labelDetails": {},
"kind": 10,
"detail": "optional, bool",
"documentation": "Desc 3",
Expand All @@ -847,7 +806,6 @@ func TestModuleCompletion_withValidDataAndSnippets(t *testing.T) {
},
{
"label": "version",
"labelDetails": {},
"kind": 10,
"detail": "optional, string",
"documentation": "Specifies a version constraint for the provider, e.g. ~\u003e 1.0",
Expand Down Expand Up @@ -1057,16 +1015,9 @@ func TestVarsCompletion_withValidData(t *testing.T) {
"id": 4,
"result": {
"isIncomplete": false,
"itemDefaults": {
"editRange": {
"start": {"line": 0, "character": 0},
"end": {"line": 0, "character": 0}
}
},
"items": [
{
"label": "test",
"labelDetails": {},
"kind": 10,
"detail": "required, string",
"insertTextFormat":1,
Expand Down Expand Up @@ -1210,16 +1161,9 @@ output "test" {
"id": 3,
"result": {
"isIncomplete": false,
"itemDefaults": {
"editRange": {
"start": {"line": 0, "character": 0},
"end": {"line": 0, "character": 0}
}
},
"items": [
{
"label": "providers",
"labelDetails": {},
"kind": 10,
"detail": "optional, map of provider references",
"documentation": "Explicit mapping of providers which the module uses",
Expand All @@ -1240,7 +1184,6 @@ output "test" {
},
{
"label": "testvar",
"labelDetails": {},
"kind": 10,
"detail": "required, string",
"insertTextFormat": 1,
Expand All @@ -1260,7 +1203,6 @@ output "test" {
},
{
"label": "version",
"labelDetails": {},
"kind": 10,
"detail": "optional, string",
"documentation": "Constraint to set the version of the module, e.g. ~\u003e 1.0. Only applicable to modules in a module registry.",
Expand Down Expand Up @@ -1298,16 +1240,9 @@ output "test" {
"id": 4,
"result": {
"isIncomplete": false,
"itemDefaults": {
"editRange": {
"start": {"line": 0, "character": 0},
"end": {"line": 0, "character": 0}
}
},
"items": [
{
"label": "module.refname.testout",
"labelDetails": {},
"kind": 6,
"detail": "number",
"insertTextFormat": 1,
Expand Down Expand Up @@ -1480,16 +1415,9 @@ output "test" {
"id": 3,
"result": {
"isIncomplete": false,
"itemDefaults": {
"editRange": {
"start": {"line": 0, "character": 0},
"end": {"line": 0, "character": 0}
}
},
"items": [
{
"label": "alpha-var",
"labelDetails": {},
"kind": 10,
"detail": "required, string",
"insertTextFormat": 1,
Expand All @@ -1509,7 +1437,6 @@ output "test" {
},
{
"label": "providers",
"labelDetails": {},
"kind": 10,
"detail": "optional, map of provider references",
"documentation": "Explicit mapping of providers which the module uses",
Expand All @@ -1530,7 +1457,6 @@ output "test" {
},
{
"label": "version",
"labelDetails": {},
"kind": 10,
"detail": "optional, string",
"documentation": "Constraint to set the version of the module, e.g. ~\u003e 1.0. Only applicable to modules in a module registry.",
Expand Down Expand Up @@ -1568,16 +1494,9 @@ output "test" {
"id": 4,
"result": {
"isIncomplete": false,
"itemDefaults": {
"editRange": {
"start": {"line": 0, "character": 0},
"end": {"line": 0, "character": 0}
}
},
"items": [
{
"label": "beta-var",
"labelDetails": {},
"kind": 10,
"detail": "required, number",
"insertTextFormat": 1,
Expand All @@ -1597,7 +1516,6 @@ output "test" {
},
{
"label": "providers",
"labelDetails": {},
"kind": 10,
"detail": "optional, map of provider references",
"documentation": "Explicit mapping of providers which the module uses",
Expand All @@ -1618,7 +1536,6 @@ output "test" {
},
{
"label": "version",
"labelDetails": {},
"kind": 10,
"detail": "optional, string",
"documentation": "Constraint to set the version of the module, e.g. ~\u003e 1.0. Only applicable to modules in a module registry.",
Expand Down Expand Up @@ -1656,16 +1573,9 @@ output "test" {
"id": 5,
"result": {
"isIncomplete": false,
"itemDefaults": {
"editRange": {
"start": {"line": 0, "character": 0},
"end": {"line": 0, "character": 0}
}
},
"items": [
{
"label": "module.alpha",
"labelDetails": {},
"kind": 6,
"detail": "object",
"insertTextFormat": 1,
Expand All @@ -1685,7 +1595,6 @@ output "test" {
},
{
"label": "module.beta",
"labelDetails": {},
"kind": 6,
"detail": "object",
"insertTextFormat": 1,
Expand Down Expand Up @@ -1820,16 +1729,9 @@ variable "ccc" {}
"id": 3,
"result": {
"isIncomplete": false,
"itemDefaults": {
"editRange": {
"start": {"line": 0, "character": 0},
"end": {"line": 0, "character": 0}
}
},
"items": [
{
"label": "var.aaa",
"labelDetails": {},
"kind": 6,
"detail": "dynamic",
"insertTextFormat": 1,
Expand All @@ -1849,7 +1751,6 @@ variable "ccc" {}
},
{
"label": "var.bbb",
"labelDetails": {},
"kind": 6,
"detail": "dynamic",
"insertTextFormat": 1,
Expand All @@ -1869,7 +1770,6 @@ variable "ccc" {}
},
{
"label": "var.ccc",
"labelDetails": {},
"kind": 6,
"detail": "dynamic",
"insertTextFormat": 1,
Expand Down
1 change: 0 additions & 1 deletion internal/langserver/handlers/completion_resolve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ func TestCompletionResolve_withoutHook(t *testing.T) {
"id": 2,
"result": {
"label": "\"test\"",
"labelDetails": {},
"kind": 1,
"data": {
"resolve_hook": "test",
Expand Down
4 changes: 2 additions & 2 deletions internal/langserver/handlers/go_to_ref_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (svc *service) GoToDefinition(ctx context.Context, params lsp.TextDocumentP
return nil, err
}

return ilsp.RefTargetsToLocationLinks(targets, cc.TextDocument.Definition.LinkSupport), nil
return ilsp.RefTargetsToDefinitionLocationLinks(targets, cc.TextDocument.Definition), nil
}

func (svc *service) GoToDeclaration(ctx context.Context, params lsp.TextDocumentPositionParams) (interface{}, error) {
Expand All @@ -37,7 +37,7 @@ func (svc *service) GoToDeclaration(ctx context.Context, params lsp.TextDocument
return nil, err
}

return ilsp.RefTargetsToLocationLinks(targets, cc.TextDocument.Declaration.LinkSupport), nil
return ilsp.RefTargetsToDeclarationLocationLinks(targets, cc.TextDocument.Declaration), nil
}

func (svc *service) goToReferenceTarget(ctx context.Context, params lsp.TextDocumentPositionParams) (decoder.ReferenceTargets, error) {
Expand Down
Loading

0 comments on commit a2210b4

Please sign in to comment.