chore: Fix a couple deprecations/obsolete calls
This commit is contained in:
parent
aaa8885081
commit
2694b9e1c1
9 changed files with 12 additions and 18 deletions
|
@ -213,7 +213,7 @@ abstract class DAPDriver<Server : IDebugProtocolServer, Client : IDebugProtocolC
|
||||||
val cli = installer.install()
|
val cli = installer.install()
|
||||||
val args = HashMap<String, Any>()
|
val args = HashMap<String, Any>()
|
||||||
args["program"] = Util.toWinPath(cli.exePath)
|
args["program"] = Util.toWinPath(cli.exePath)
|
||||||
args["cmd"] = cli.workDirectory.toString()
|
args["cmd"] = cli.workingDirectory.toString()
|
||||||
args["name"] = "CPP Debug"
|
args["name"] = "CPP Debug"
|
||||||
args["type"] = "cppvsdbg"
|
args["type"] = "cppvsdbg"
|
||||||
args["request"] = "launch"
|
args["request"] = "launch"
|
||||||
|
@ -953,7 +953,7 @@ abstract class DAPDriver<Server : IDebugProtocolServer, Client : IDebugProtocolC
|
||||||
|
|
||||||
fun runInTerminalAsync(args: RunInTerminalRequestArguments): RunInTerminalResponse {
|
fun runInTerminalAsync(args: RunInTerminalRequestArguments): RunInTerminalResponse {
|
||||||
val cli = PtyCommandLine(args.args.toList())
|
val cli = PtyCommandLine(args.args.toList())
|
||||||
cli.charset = Charsets.UTF_8
|
cli.withCharset(Charsets.UTF_8)
|
||||||
val cwd = args.cwd?.ifBlank { null }?.toNioPathOrNull()
|
val cwd = args.cwd?.ifBlank { null }?.toNioPathOrNull()
|
||||||
if (cwd != null) {
|
if (cwd != null) {
|
||||||
cli.withWorkingDirectory(cwd)
|
cli.withWorkingDirectory(cwd)
|
||||||
|
|
|
@ -230,7 +230,7 @@ class ZigDebuggerToolchainService {
|
||||||
val binaryToDownload = binariesToDownload.first { it.url == downloadUrl }
|
val binaryToDownload = binariesToDownload.first { it.url == downloadUrl }
|
||||||
val propertyName = binaryToDownload.propertyName
|
val propertyName = binaryToDownload.propertyName
|
||||||
val archiveFile = result.first
|
val archiveFile = result.first
|
||||||
Unarchiver.unarchive(archiveFile, downloadDir, binaryToDownload.prefix)
|
Unarchiver.unarchive(archiveFile.toPath(), baseDir, binaryToDownload.prefix)
|
||||||
archiveFile.delete()
|
archiveFile.delete()
|
||||||
versions[propertyName] = binaryToDownload.version
|
versions[propertyName] = binaryToDownload.version
|
||||||
}
|
}
|
||||||
|
@ -333,23 +333,23 @@ class ZigDebuggerToolchainService {
|
||||||
private enum class Unarchiver {
|
private enum class Unarchiver {
|
||||||
ZIP {
|
ZIP {
|
||||||
override val extension = "zip"
|
override val extension = "zip"
|
||||||
override fun createDecompressor(file: File) = Decompressor.Zip(file)
|
override fun createDecompressor(file: Path) = Decompressor.Zip(file)
|
||||||
},
|
},
|
||||||
TAR {
|
TAR {
|
||||||
override val extension = "tar.gz"
|
override val extension = "tar.gz"
|
||||||
override fun createDecompressor(file: File) = Decompressor.Tar(file)
|
override fun createDecompressor(file: Path) = Decompressor.Tar(file)
|
||||||
},
|
},
|
||||||
VSIX {
|
VSIX {
|
||||||
override val extension = "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 val extension: String
|
||||||
protected abstract fun createDecompressor(file: File): Decompressor
|
protected abstract fun createDecompressor(file: Path): Decompressor
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@Throws(IOException::class)
|
@Throws(IOException::class)
|
||||||
suspend fun unarchive(archivePath: File, dst: File, prefix: String? = null) {
|
suspend fun unarchive(archivePath: Path, dst: Path, prefix: String? = null) {
|
||||||
runInterruptible {
|
runInterruptible {
|
||||||
val unarchiver = entries.find { archivePath.name.endsWith(it.extension) } ?: error("Unexpected archive type: $archivePath")
|
val unarchiver = entries.find { archivePath.name.endsWith(it.extension) } ?: error("Unexpected archive type: $archivePath")
|
||||||
val dec = unarchiver.createDecompressor(archivePath)
|
val dec = unarchiver.createDecompressor(archivePath)
|
||||||
|
|
|
@ -40,7 +40,7 @@ abstract class MSVCDriverConfiguration: DAPDebuggerDriverConfiguration() {
|
||||||
override fun createDriverCommandLine(driver: DebuggerDriver, arch: ArchitectureType): GeneralCommandLine {
|
override fun createDriverCommandLine(driver: DebuggerDriver, arch: ArchitectureType): GeneralCommandLine {
|
||||||
val path = debuggerExecutable
|
val path = debuggerExecutable
|
||||||
val cli = GeneralCommandLine()
|
val cli = GeneralCommandLine()
|
||||||
cli.exePath = path.pathString
|
cli.withExePath(path.pathString)
|
||||||
cli.addParameters("--interpreter=vscode", "--extconfigdir=%USERPROFILE%\\.cppvsdbg\\extensions")
|
cli.addParameters("--interpreter=vscode", "--extconfigdir=%USERPROFILE%\\.cppvsdbg\\extensions")
|
||||||
cli.withWorkingDirectory(path.parent)
|
cli.withWorkingDirectory(path.parent)
|
||||||
return cli
|
return cli
|
||||||
|
|
|
@ -20,8 +20,6 @@
|
||||||
* along with ZigBrains. If not, see <https://www.gnu.org/licenses/>.
|
* along with ZigBrains. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@file:Suppress("HardCodedStringLiteral")
|
|
||||||
|
|
||||||
package com.falsepattern.zigbrains.lsp.config
|
package com.falsepattern.zigbrains.lsp.config
|
||||||
|
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
|
|
|
@ -65,9 +65,9 @@ abstract class ZigProfileState<T: ZigExecConfig<T>> (
|
||||||
// TODO remove this check once JetBrains implements colored terminal in the debugger
|
// 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
|
// 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()
|
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) }
|
workingDir.path?.let { cli.withWorkingDirectory(it) }
|
||||||
cli.charset = Charsets.UTF_8
|
cli.withCharset(Charsets.UTF_8)
|
||||||
cli.addParameters(configuration.buildCommandLineArgs(debug))
|
cli.addParameters(configuration.buildCommandLineArgs(debug))
|
||||||
return configuration.patchCommandLine(cli)
|
return configuration.patchCommandLine(cli)
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ abstract class ZigTool(val toolchain: AbstractZigToolchain) {
|
||||||
): GeneralCommandLine {
|
): GeneralCommandLine {
|
||||||
val cli = GeneralCommandLine()
|
val cli = GeneralCommandLine()
|
||||||
.withExePath(toolchain.pathToExecutable(toolName).toString())
|
.withExePath(toolchain.pathToExecutable(toolName).toString())
|
||||||
.withWorkDirectory(workingDirectory?.toString())
|
.withWorkingDirectory(workingDirectory)
|
||||||
.withParameters(*parameters)
|
.withParameters(*parameters)
|
||||||
.withCharset(Charsets.UTF_8)
|
.withCharset(Charsets.UTF_8)
|
||||||
return toolchain.patchCommandLine(cli)
|
return toolchain.patchCommandLine(cli)
|
||||||
|
|
|
@ -93,7 +93,6 @@ class ZigColorSettingsPage: ColorSettingsPage {
|
||||||
ADD_HIGHLIGHT
|
ADD_HIGHLIGHT
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("HardCodedStringLiteral")
|
|
||||||
private val ADD_HIGHLIGHT = HashMap<String, TextAttributesKey>().apply {
|
private val ADD_HIGHLIGHT = HashMap<String, TextAttributesKey>().apply {
|
||||||
this["enum"] = ZigSyntaxHighlighter.ENUM_REF
|
this["enum"] = ZigSyntaxHighlighter.ENUM_REF
|
||||||
this["enum_decl"] = ZigSyntaxHighlighter.ENUM_DECL
|
this["enum_decl"] = ZigSyntaxHighlighter.ENUM_DECL
|
||||||
|
|
|
@ -102,7 +102,6 @@ class ZigSyntaxHighlighter: SyntaxHighlighterBase() {
|
||||||
*ZigTypes::class.java
|
*ZigTypes::class.java
|
||||||
.fields
|
.fields
|
||||||
.filter {
|
.filter {
|
||||||
@Suppress("HardCodedStringLiteral")
|
|
||||||
it.name.startsWith("KEYWORD_")
|
it.name.startsWith("KEYWORD_")
|
||||||
}
|
}
|
||||||
.map { it.get(null) as IElementType }
|
.map { it.get(null) as IElementType }
|
||||||
|
|
|
@ -20,8 +20,6 @@
|
||||||
* along with ZigBrains. If not, see <https://www.gnu.org/licenses/>.
|
* along with ZigBrains. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@file:Suppress("HardCodedStringLiteral")
|
|
||||||
|
|
||||||
package com.falsepattern.zigbrains.zig.util
|
package com.falsepattern.zigbrains.zig.util
|
||||||
|
|
||||||
import com.intellij.openapi.util.TextRange
|
import com.intellij.openapi.util.TextRange
|
||||||
|
|
Loading…
Add table
Reference in a new issue