chore: Fix a couple deprecations/obsolete calls

This commit is contained in:
FalsePattern 2025-01-31 15:18:37 +01:00
parent aaa8885081
commit 2694b9e1c1
Signed by: falsepattern
GPG key ID: E930CDEC50C50E23
9 changed files with 12 additions and 18 deletions

View file

@ -213,7 +213,7 @@ abstract class DAPDriver<Server : IDebugProtocolServer, Client : IDebugProtocolC
val cli = installer.install()
val args = HashMap<String, Any>()
args["program"] = Util.toWinPath(cli.exePath)
args["cmd"] = cli.workDirectory.toString()
args["cmd"] = cli.workingDirectory.toString()
args["name"] = "CPP Debug"
args["type"] = "cppvsdbg"
args["request"] = "launch"
@ -953,7 +953,7 @@ abstract class DAPDriver<Server : IDebugProtocolServer, Client : IDebugProtocolC
fun runInTerminalAsync(args: RunInTerminalRequestArguments): RunInTerminalResponse {
val cli = PtyCommandLine(args.args.toList())
cli.charset = Charsets.UTF_8
cli.withCharset(Charsets.UTF_8)
val cwd = args.cwd?.ifBlank { null }?.toNioPathOrNull()
if (cwd != null) {
cli.withWorkingDirectory(cwd)

View file

@ -230,7 +230,7 @@ class ZigDebuggerToolchainService {
val binaryToDownload = binariesToDownload.first { it.url == downloadUrl }
val propertyName = binaryToDownload.propertyName
val archiveFile = result.first
Unarchiver.unarchive(archiveFile, downloadDir, binaryToDownload.prefix)
Unarchiver.unarchive(archiveFile.toPath(), baseDir, binaryToDownload.prefix)
archiveFile.delete()
versions[propertyName] = binaryToDownload.version
}
@ -333,23 +333,23 @@ class ZigDebuggerToolchainService {
private enum class Unarchiver {
ZIP {
override val extension = "zip"
override fun createDecompressor(file: File) = Decompressor.Zip(file)
override fun createDecompressor(file: Path) = Decompressor.Zip(file)
},
TAR {
override val extension = "tar.gz"
override fun createDecompressor(file: File) = Decompressor.Tar(file)
override fun createDecompressor(file: Path) = Decompressor.Tar(file)
},
VSIX {
override val extension = "vsix"
override fun createDecompressor(file: File) = Decompressor.Zip(file)
override fun createDecompressor(file: Path) = Decompressor.Zip(file)
};
protected abstract val extension: String
protected abstract fun createDecompressor(file: File): Decompressor
protected abstract fun createDecompressor(file: Path): Decompressor
companion object {
@Throws(IOException::class)
suspend fun unarchive(archivePath: File, dst: File, prefix: String? = null) {
suspend fun unarchive(archivePath: Path, dst: Path, prefix: String? = null) {
runInterruptible {
val unarchiver = entries.find { archivePath.name.endsWith(it.extension) } ?: error("Unexpected archive type: $archivePath")
val dec = unarchiver.createDecompressor(archivePath)

View file

@ -40,7 +40,7 @@ abstract class MSVCDriverConfiguration: DAPDebuggerDriverConfiguration() {
override fun createDriverCommandLine(driver: DebuggerDriver, arch: ArchitectureType): GeneralCommandLine {
val path = debuggerExecutable
val cli = GeneralCommandLine()
cli.exePath = path.pathString
cli.withExePath(path.pathString)
cli.addParameters("--interpreter=vscode", "--extconfigdir=%USERPROFILE%\\.cppvsdbg\\extensions")
cli.withWorkingDirectory(path.parent)
return cli

View file

@ -20,8 +20,6 @@
* along with ZigBrains. If not, see <https://www.gnu.org/licenses/>.
*/
@file:Suppress("HardCodedStringLiteral")
package com.falsepattern.zigbrains.lsp.config
import kotlinx.serialization.SerialName

View file

@ -65,9 +65,9 @@ abstract class ZigProfileState<T: ZigExecConfig<T>> (
// TODO remove this check once JetBrains implements colored terminal in the debugger
// https://youtrack.jetbrains.com/issue/CPP-11622/ANSI-color-codes-not-honored-in-Debug-Run-Configuration-output-window
val cli = if (configuration.emulateTerminal() && !debug) PtyCommandLine().withConsoleMode(true).withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.CONSOLE) else GeneralCommandLine()
cli.exePath = zigExePath.pathString
cli.withExePath(zigExePath.pathString)
workingDir.path?.let { cli.withWorkingDirectory(it) }
cli.charset = Charsets.UTF_8
cli.withCharset(Charsets.UTF_8)
cli.addParameters(configuration.buildCommandLineArgs(debug))
return configuration.patchCommandLine(cli)
}

View file

@ -62,7 +62,7 @@ abstract class ZigTool(val toolchain: AbstractZigToolchain) {
): GeneralCommandLine {
val cli = GeneralCommandLine()
.withExePath(toolchain.pathToExecutable(toolName).toString())
.withWorkDirectory(workingDirectory?.toString())
.withWorkingDirectory(workingDirectory)
.withParameters(*parameters)
.withCharset(Charsets.UTF_8)
return toolchain.patchCommandLine(cli)

View file

@ -93,7 +93,6 @@ class ZigColorSettingsPage: ColorSettingsPage {
ADD_HIGHLIGHT
}
@Suppress("HardCodedStringLiteral")
private val ADD_HIGHLIGHT = HashMap<String, TextAttributesKey>().apply {
this["enum"] = ZigSyntaxHighlighter.ENUM_REF
this["enum_decl"] = ZigSyntaxHighlighter.ENUM_DECL

View file

@ -102,7 +102,6 @@ class ZigSyntaxHighlighter: SyntaxHighlighterBase() {
*ZigTypes::class.java
.fields
.filter {
@Suppress("HardCodedStringLiteral")
it.name.startsWith("KEYWORD_")
}
.map { it.get(null) as IElementType }

View file

@ -20,8 +20,6 @@
* along with ZigBrains. If not, see <https://www.gnu.org/licenses/>.
*/
@file:Suppress("HardCodedStringLiteral")
package com.falsepattern.zigbrains.zig.util
import com.intellij.openapi.util.TextRange