Skip to content

Commit

Permalink
Release 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
aarcangeli committed Nov 2, 2024
1 parent d42a933 commit ea654f8
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 30 deletions.
15 changes: 15 additions & 0 deletions .idea/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 2 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@

# idea-clang-format Changelog

[Unreleased]

## [1.0.0] - 2024-11-02
## [Unreleased]

### Added
- Initial scaffold created from [IntelliJ Platform Plugin Template](https://github.com/JetBrains/intellij-platform-plugin-template)
- Language support for `.clang-format` files
- Detect indentation style and column limit from `.clang-format` file
- Format code using `clang-format` binary
- Settings page to configure `clang-format` binary path
- Format on save option

[Unreleased]: https://github.com/aarcangeli/idea-clang-format/compare/v1.0.0...HEAD
[1.0.0]: https://github.com/aarcangeli/idea-clang-format/commits/v1.0.0
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pluginGroup = com.github.aarcangeli.idea-clang-format
pluginName = idea-clang-format
pluginRepositoryUrl = https://github.com/aarcangeli/idea-clang-format
# SemVer format -> https://semver.org
pluginVersion = 0.0.2-beta
pluginVersion = 1.0.0

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 233
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ package com.github.aarcangeli.ideaclangformat.experimental

import com.github.aarcangeli.ideaclangformat.ClangFormatConfig
import com.github.aarcangeli.ideaclangformat.MyBundle
import com.github.aarcangeli.ideaclangformat.exceptions.ClangValidationError
import com.github.aarcangeli.ideaclangformat.exceptions.ClangFormatError
import com.github.aarcangeli.ideaclangformat.exceptions.ClangValidationError
import com.github.aarcangeli.ideaclangformat.services.ClangFormatService
import com.github.aarcangeli.ideaclangformat.services.ClangFormatStyleService
import com.github.aarcangeli.ideaclangformat.utils.ClangFormatCommons
import com.intellij.CodeStyleBundle
import com.intellij.icons.AllIcons
import com.intellij.ide.actions.ShowSettingsUtilImpl
import com.intellij.ide.util.PsiNavigationSupport
Expand Down Expand Up @@ -56,7 +55,7 @@ class ClangFormatStyleSettingsModifier : CodeStyleSettingsModifier {
if (!formatService.mayBeFormatted(file, true)) {
// clang format disabled for this file
file.putUserData(LAST_PROVIDED_SETTINGS, null)
return true
return false
}

try {
Expand Down Expand Up @@ -88,12 +87,10 @@ class ClangFormatStyleSettingsModifier : CodeStyleSettingsModifier {
return object : IndentStatusBarUIContributor(settings.indentOptions) {
override fun getTooltip(): String {
val builder = HtmlBuilder()
builder.append(
HtmlChunk.span("color:" + ColorUtil.toHtmlColor(JBColor.GRAY))
.addText(MyBundle.message("error.clang-format.status.hint"))
)
builder.append(MyBundle.message("error.clang-format.status.hint"))
.br()
builder
.append(CodeStyleBundle.message("indent.status.bar.indent.tooltip"))
.append("Indent:")
.append(" ")
.append(
HtmlChunk.tag("b").addText(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ class ClangFormatStyleServiceImpl : ClangFormatStyleService, Disposable {
}

override fun getRawFormatStyle(psiFile: PsiFile): Map<String, Any> {
// save changed documents
saveUnsavedClangFormatFiles()
val result = CachedValuesManager.getCachedValue(psiFile, CLANG_STYLE, FormatStyleProvider(this, psiFile))
if (result.second != null) {
throw result.second!!
Expand Down Expand Up @@ -120,19 +118,6 @@ class ClangFormatStyleServiceImpl : ClangFormatStyleService, Disposable {
return getClangFormatFiles(virtualFile).isNotEmpty()
}

private fun saveUnsavedClangFormatFiles() {
// save changed documents
if (ClangFormatCommons.getUnsavedClangFormats().isNotEmpty()) {
ApplicationManager.getApplication().invokeLater {
WriteAction.run<RuntimeException> {
for (document in ClangFormatCommons.getUnsavedClangFormats()) {
FileDocumentManager.getInstance().saveDocument(document)
}
}
}
}
}

override fun dispose() {}

private fun dropCaches() {
Expand Down

0 comments on commit ea654f8

Please sign in to comment.