1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-04-30 13:34:04 +02:00

Make source command to throw exceptions

This commit is contained in:
lippfi 2021-11-18 07:19:28 +03:00
parent ca934fe514
commit cf5cc92258
2 changed files with 3 additions and 3 deletions
src/main/java/com/maddyhome/idea/vim/vimscript

View File

@ -93,11 +93,11 @@ object Executor {
} }
@JvmStatic @JvmStatic
fun executeFile(file: File) { fun executeFile(file: File, indicateErrors: Boolean = false) {
val editor = TextComponentEditorImpl(null, JTextArea()) val editor = TextComponentEditorImpl(null, JTextArea())
val context = DataContext.EMPTY_CONTEXT val context = DataContext.EMPTY_CONTEXT
try { try {
execute(file.readText(), editor, context, skipHistory = true, indicateErrors = false) execute(file.readText(), editor, context, skipHistory = true, indicateErrors)
} catch (ignored: IOException) { } } catch (ignored: IOException) { }
} }

View File

@ -33,7 +33,7 @@ data class SourceCommand(val ranges: Ranges, val argument: String) : Command.Sin
override val argFlags = flags(RangeFlag.RANGE_FORBIDDEN, ArgumentFlag.ARGUMENT_REQUIRED, Access.READ_ONLY) override val argFlags = flags(RangeFlag.RANGE_FORBIDDEN, ArgumentFlag.ARGUMENT_REQUIRED, Access.READ_ONLY)
override fun processCommand(editor: Editor, context: DataContext): ExecutionResult { override fun processCommand(editor: Editor, context: DataContext): ExecutionResult {
val path = expandUser(argument.trim()) val path = expandUser(argument.trim())
Executor.executeFile(File(path)) Executor.executeFile(File(path), true)
return ExecutionResult.Success return ExecutionResult.Success
} }