-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f0eeb9f
commit 977d344
Showing
6 changed files
with
55 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from core.handler import Handler | ||
from core.utils import * | ||
|
||
|
||
class RangeFormatting(Handler): | ||
name = "rangeFormatting" | ||
method = "textDocument/rangeFormatting" | ||
cancel_on_change = True | ||
provider = "range_format_provider" | ||
provider_message = "Current server not support range format." | ||
|
||
def process_request(self, range_start, range_end, tab_size) -> dict: | ||
range = { | ||
"start": range_start, | ||
"end": range_end | ||
} | ||
|
||
options = { | ||
"tabSize": tab_size, | ||
"insertSpaces": self.file_action.insert_spaces, | ||
"trimTrailingWhitespace": True, | ||
"insertFinalNewline": False, | ||
"trimFinalNewlines": True, | ||
} | ||
|
||
return dict(range=range, options=options) | ||
|
||
def process_response(self, response) -> None: | ||
if response and len(response) > 0: | ||
eval_in_emacs("lsp-bridge-format--update", self.file_action.filepath, response) | ||
else: | ||
message_emacs("Nothing need format.") |
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