「open_file」で作成したビューに挿入できないようです。
import sublime, sublime_plugin, re, os.path
class ExtractToViewCommand(sublime_plugin.TextCommand):
def run(self, edit):
view = sublime.active_window().open_file("/path/to/some/file/that/doesnt/exist/yet")
view.set_read_only(False)
print(view.is_read_only()) # prints True!
e = view.begin_edit()
view.insert(e, 0, "hello world") # returns 0!
view.end_edit(e)
ここでの私の目標は、選択したテキストを新しいファイルに抽出するプラグインを作成することです。new_file
の代わりに使用するように変更すると、挿入は問題なく機能しopen_file
ます。私が見逃しているアイデアはありますか?