-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reflect differences between the two libraries
- Loading branch information
1 parent
97fe4c3
commit bb0fbe3
Showing
22 changed files
with
193 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package lsp | ||
|
||
import ( | ||
"github.com/hashicorp/hcl-lang/lang" | ||
"github.com/hashicorp/terraform-ls/internal/mdplain" | ||
lsp "github.com/hashicorp/terraform-ls/internal/protocol" | ||
) | ||
|
||
func markupContent(content lang.MarkupContent, mdSupported bool) lsp.MarkupContent { | ||
value := content.Value | ||
|
||
kind := lsp.PlainText | ||
if content.Kind == lang.MarkdownKind { | ||
if mdSupported { | ||
kind = lsp.Markdown | ||
} else { | ||
value = mdplain.Clean(value) | ||
} | ||
} | ||
|
||
return lsp.MarkupContent{ | ||
Kind: kind, | ||
Value: value, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package lsp | ||
|
||
import ( | ||
"github.com/hashicorp/hcl-lang/lang" | ||
"github.com/hashicorp/terraform-ls/internal/filesystem" | ||
lsp "github.com/hashicorp/terraform-ls/internal/protocol" | ||
) | ||
|
||
func TextEditsFromDocumentChanges(changes filesystem.DocumentChanges) []lsp.TextEdit { | ||
edits := make([]lsp.TextEdit, len(changes)) | ||
|
||
for i, change := range changes { | ||
edits[i] = lsp.TextEdit{ | ||
Range: fsRangeToLSP(change.Range()), | ||
NewText: change.Text(), | ||
} | ||
} | ||
|
||
return edits | ||
} | ||
|
||
func textEdits(tes []lang.TextEdit, snippetSupport bool) []lsp.TextEdit { | ||
edits := make([]lsp.TextEdit, len(tes)) | ||
|
||
for i, te := range tes { | ||
edits[i] = *textEdit(te, snippetSupport) | ||
} | ||
|
||
return edits | ||
} | ||
|
||
func textEdit(te lang.TextEdit, snippetSupport bool) *lsp.TextEdit { | ||
if snippetSupport { | ||
return &lsp.TextEdit{ | ||
NewText: te.Snippet, | ||
Range: HCLRangeToLSP(te.Range), | ||
} | ||
} | ||
|
||
return &lsp.TextEdit{ | ||
NewText: te.NewText, | ||
Range: HCLRangeToLSP(te.Range), | ||
} | ||
} | ||
|
||
func insertTextFormat(snippetSupport bool) lsp.InsertTextFormat { | ||
if snippetSupport { | ||
return lsp.SnippetTextFormat | ||
} | ||
|
||
return lsp.PlainTextTextFormat | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.