⁠
kyle wood: Re-work some NBT handling for better performance, and handle big files
This commit includes some default NBT formatting settings which result
in smaller files, and re-implements NbtVirtualFile to be a
LightVirtualFile. Part of that re-implementation is to make NBT files
only write to disk when saved manually, which is the behavior I
originally wanted anyways. This feels much safer and more stable than
whatever was happening originally.
By being a LightVirtualFile it seems the size limits / requirements on
Psi files are relaxed, but I don't fully understand the details. It
seems to handle larger NBT files better now.
Relevant issues: #1894 , #1893
This commit includes some default NBT formatting settings which result
in smaller files, and re-implements NbtVirtualFile to be a
LightVirtualFile. Part of that re-implementation is to make NBT files
only write to disk when saved manually, which is the behavior I
originally wanted anyways. This feels much safer and more stable than
whatever was happening originally.
By being a LightVirtualFile it seems the size limits / requirements on
Psi files are relaxed, but I don't fully understand the details. It
seems to handle larger NBT files better now.
Relevant issues: #1894 , #1893
- /*
- * Minecraft Dev for IntelliJ
- *
- * https://minecraftdev.org
- *
- * Copyright (c) 2022 minecraft-dev
- *
- * MIT License
- */
- package com.demonwav.mcdev.nbt.lang.format
- import com.demonwav.mcdev.nbt.lang.NbttLanguage
- import com.intellij.psi.codeStyle.CodeStyleSettings
- import com.intellij.psi.codeStyle.CommonCodeStyleSettings
- import com.intellij.psi.codeStyle.CustomCodeStyleSettings
- class NbttCodeStyleSettings(container: CodeStyleSettings) : CustomCodeStyleSettings(NbttLanguage.id, container) {
- @JvmField
- var SPACE_AFTER_COLON = true
- @JvmField
- var SPACE_BEFORE_COLON = false
- @JvmField
- var LIST_WRAPPING = CommonCodeStyleSettings.WRAP_ALWAYS
- @JvmField
- var ARRAY_WRAPPING = CommonCodeStyleSettings.WRAP_ALWAYS
- }
- /*
- * Minecraft Dev for IntelliJ
- *
- * https://minecraftdev.org
- *
- * Copyright (c) 2022 minecraft-dev
- *
- * MIT License
- */
- package com.demonwav.mcdev.nbt.lang.format
- import com.demonwav.mcdev.nbt.lang.NbttLanguage
- import com.intellij.psi.codeStyle.CodeStyleSettings
- import com.intellij.psi.codeStyle.CommonCodeStyleSettings
- import com.intellij.psi.codeStyle.CustomCodeStyleSettings
- @Suppress("PropertyName")
- class NbttCodeStyleSettings(container: CodeStyleSettings) : CustomCodeStyleSettings(NbttLanguage.id, container) {
- @JvmField
- var SPACE_AFTER_COLON = true
- @JvmField
- var SPACE_BEFORE_COLON = false
- @JvmField
- var LIST_WRAPPING = CommonCodeStyleSettings.WRAP_AS_NEEDED
- @JvmField
- var ARRAY_WRAPPING = CommonCodeStyleSettings.WRAP_AS_NEEDED
- }