-
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into server-error-handling
- Loading branch information
Showing
33 changed files
with
8,163 additions
and
18,135 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
2,294 changes: 442 additions & 1,852 deletions
2,294
Src/CSharpier.Playground/ClientApp/package-lock.json
Large diffs are not rendered by default.
Oops, something went wrong.
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
46 changes: 0 additions & 46 deletions
46
Src/CSharpier.Rider/src/main/java/com/intellij/csharpier/ReformatWithCSharpierOnSave.java
This file was deleted.
Oops, something went wrong.
40 changes: 40 additions & 0 deletions
40
...rpier.Rider/src/main/java/com/intellij/csharpier/ReformatWithCSharpierOnSaveListener.java
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,40 @@ | ||
package com.intellij.csharpier; | ||
|
||
import com.intellij.openapi.diagnostic.Logger; | ||
import com.intellij.openapi.editor.Document; | ||
import com.intellij.openapi.fileEditor.FileDocumentManager; | ||
import com.intellij.openapi.fileEditor.FileDocumentManagerListener; | ||
import com.intellij.openapi.project.Project; | ||
import com.intellij.openapi.project.ProjectUtil; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
public class ReformatWithCSharpierOnSaveListener implements FileDocumentManagerListener { | ||
Logger logger = CSharpierLogger.getInstance(); | ||
|
||
@Override | ||
public void beforeDocumentSaving(@NotNull Document document) { | ||
var project = this.GetProject(document); | ||
if (project == null) { | ||
return; | ||
} | ||
|
||
var cSharpierSettings = CSharpierSettings.getInstance(project); | ||
if (!cSharpierSettings.getRunOnSave()) { | ||
return; | ||
} | ||
|
||
var formattingService = FormattingService.getInstance(project); | ||
this.logger.debug("beforeDocumentSaving for " + document); | ||
formattingService.format(document, project); | ||
} | ||
|
||
private Project GetProject(@NotNull Document document) { | ||
var virtualFile = FileDocumentManager.getInstance().getFile(document); | ||
if (virtualFile == null) { | ||
return null; | ||
} | ||
|
||
return ProjectUtil.guessProjectForContentFile(virtualFile); | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
| ||
CSharpier.CodeFormatterOptions.IncludeGenerated.get -> bool | ||
CSharpier.CodeFormatterOptions.IncludeGenerated.init -> void |
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,22 @@ | ||
namespace CSharpier.Utilities; | ||
|
||
using System.Diagnostics.CodeAnalysis; | ||
|
||
internal static class StackExtensions | ||
{ | ||
#if NETSTANDARD2_0 | ||
public static bool TryPop<T>(this Stack<T> stack, [NotNullWhen(true)] out T? result) | ||
{ | ||
if (stack.Count > 0) | ||
{ | ||
result = stack.Pop()!; | ||
return true; | ||
} | ||
else | ||
{ | ||
result = default; | ||
return false; | ||
} | ||
} | ||
#endif | ||
} |
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
Oops, something went wrong.