I’m trying to create a sublime text 3 plugin that copies code from files like .html, .css, .js & .php and then pastes it in a txt document.
My problem is that sometimes when I copy code from a document with a lot of code and paste it into a text document, some of the code disappears.
When I just copy text from a txt file with 300 lines it works fine but when I do the same with .php or .js it doesn’t work, I only get 50-100 of the 300 lines.
import sublime
import sublime_plugin
def save_code(file):
sublime.active_window().active_view().set_status("","Your file is
saved inside _templates " + file + "!")
text_file = open("path_to_file/_templates"+file, "w")
my_copy = str(sublime.get_clipboard())
text_file.write("%s" % my_copy)
text_file.close()
class MycopypasteCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.window().show_input_panel("Add
filename:","",save_code,None,None)