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:
parent
ca934fe514
commit
cf5cc92258
src/main/java/com/maddyhome/idea/vim/vimscript
@ -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) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user