File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed
Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -341,7 +341,26 @@ std::shared_ptr<vscode::Serializable> LanguageService::OnTypeFormatting(
341341 auto formatResult = LanguageClient::GetInstance ().GetService <CodeFormatService>()->RangeFormat (
342342 formattedRange, parser, tempOptions);
343343
344-
344+ // workaround TODO 实现真正的typeformat
345+ if (!formatResult.ends_with (' \n ' ))
346+ {
347+ switch (options->end_of_line )
348+ {
349+ case EndOfLine::CRLF:
350+ {
351+ formatResult.append (" \r\n " );
352+ break ;
353+ }
354+ case EndOfLine::LF:
355+ {
356+ formatResult.push_back (' \n ' );
357+ }
358+ default :
359+ {
360+ break ;
361+ }
362+ }
363+ }
345364 auto & edit = result->edits .emplace_back ();
346365 edit.newText = std::move (formatResult);
347366 edit.range = vscode::Range (
@@ -486,7 +505,6 @@ std::shared_ptr<vscode::DocumentDiagnosticReport> LanguageService::OnTextDocumen
486505std::shared_ptr<vscode::WorkspaceDiagnosticReport> LanguageService::OnWorkspaceDiagnostic (
487506 std::shared_ptr<vscode::WorkspaceDiagnosticParams> param)
488507{
489-
490508 // if(param->previousResultIds.empty())
491509 // {
492510 // LanguageClient::GetInstance().LoadWorkspace();
You can’t perform that action at this time.
0 commit comments