Esempio n. 1
0
        public void InsertSnippet()
        {
            var editor = new ScintillaGateway(PluginBase.GetCurrentScintilla());

            editor.AddText(SnippetBody.Length, SnippetBody);

            using (TextToFind textToFind = new TextToFind(editor.GetCurrentPos().Value - SnippetBody.Length, editor.GetCurrentPos().Value, Placeholder))
            {
                Position placeholderPosition = editor.FindText(0, textToFind);
                editor.SetSelection(placeholderPosition.Value + Placeholder.Length, placeholderPosition.Value);
            }
        }
Esempio n. 2
0
        internal static void printDebugLine()
        {
            IntPtr           hCurrScintilla = PluginBase.GetCurrentScintilla();
            ScintillaGateway sci            = new ScintillaGateway(hCurrScintilla);
            var lineNumber       = sci.GetCurrentLineNumber() + 1;
            NotepadPPGateway npp = new NotepadPPGateway();
            var fileName         = Path.GetFileNameWithoutExtension(npp.GetCurrentFilePath());
            var stream           = new FileStream(@"plugins/Config/GoToDefinition/debug_table.txt", FileMode.Open, FileAccess.Read);

            using (var streamReader = new StreamReader(stream, Encoding.UTF8))
            {
                var text = streamReader.ReadToEnd();
                text = text + $"'{fileName}', {lineNumber}, )";
                sci.AddText(text.Length, text);
            }
        }