Ejemplo n.º 1
0
 public void GoTo(Location location, string window)
 {
     Publisher.Run(
         string.Format(
             "test-editor goto \"{0}|{1}|{2}\"",
             location.File,
             location.Line,
             location.Column));
 }
Ejemplo n.º 2
0
 public void GoTo(Location location)
 {
     if (_goToCommand == null)
         return;
     runCommand(
         _goToCommand.Executable,
         _goToCommand.Parameter
             .Replace("{0}", location.File)
             .Replace("{1}", location.Line.ToString())
             .Replace("{2}", location.Column.ToString()),
         false);
     SetFocus();
 }
Ejemplo n.º 3
0
 public void Initialize(Location location)
 {
     var argument = "";
     if (location != null)
         argument = string.Format("{0} +{1}", location.File, location.Line);
     if (_process != null)
         _process.Kill();
     _process = new Process();
     _process.StartInfo = new ProcessStartInfo("gedit", argument);
     _process.StartInfo.CreateNoWindow = true;
     _process.StartInfo.UseShellExecute = true;
     _process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
     _process.Start();
 }
Ejemplo n.º 4
0
 private void goTo(int buffer, Location location)
 {
     send("{0}:setDot!0 {1}/{2}", buffer, location.Line, location.Column - 1);
 }
Ejemplo n.º 5
0
 public void Insert(EditorInsertMessage message)
 {
     GoTo(new Location(
         message.Destination.File,
         message.Destination.Line,
         message.Destination.Column));
     var location = getLocation();
     if (location == null)
         return;
     var newline = "\\n";
     if (Environment.OSVersion.Platform != PlatformID.Unix &&
         Environment.OSVersion.Platform != PlatformID.MacOSX)
         newline = "\\r\\n";
     var content = runFunction("{0}:getText", location.Buffer.ID);
     if (content == null)
         return;
     var lines = content.Split(new[] { newline }, StringSplitOptions.None);
     if (lines.Length < location.Line)
     {
         Logger.Write("Asked for line {0} but document only contained {1} lines",
             location.Line,
             lines.Length);
         return;
     }
     var line = lines[location.Line - 1];
     if (line.Length < location.Column)
     {
         Logger.Write("Asked for column {0} but line was only {1} chars long",
             location.Column,
             line);
         return;
     }
     var insertColumn = location.Column; // + ((message.Destination.Column - 1) - location.Column);
     var lineModified =
         line.Substring(0, insertColumn) +
         message.Text
             .Replace(Environment.NewLine, newline)
             .Replace("\"", "\\\"") +
         line.Substring(insertColumn, line.Length - insertColumn);
     var length = line.Length;
     var lastLine = location.Line != lines.Length - 1;
     if (lastLine)
         length += newline.Length;
     send("{0}:remove/0 {1} {2}",
         location.Buffer.ID,
         location.Offset - location.Column,
         length - 1);
     send("{0}:insert/0 {1} \"{2}\"",
         location.Buffer.ID,
         location.Offset - location.Column,
         lineModified);
     if (message.MoveOffset != null)
     {
         var offsetLocation = new Location(
             message.Destination.File,
             message.Destination.Line,
             message.Destination.Column);
         offsetLocation.Add(message.MoveOffset);
         GoTo(offsetLocation);
     }
     else
     {
         GoTo(new Location(
             message.Destination.File,
             message.Destination.Line,
             message.Destination.Column + message.Text.Length));
     }
 }
Ejemplo n.º 6
0
 public void Initialize(Location location, string[] args)
 {
     _server = null;
     _server = new TcpServer(Environment.NewLine);
     _server.IncomingMessage += Handle_serverIncomingMessage;
     _server.ClientConnected += Handle_serverClientConnected;
     _server.Start();
     Logger.Write("Server started and running on port {0}", _server.Port);
     _executable = getExecutable(args);
     _parameters = getParameters();
     if (_process != null)
         _process.Kill();
     _process = new Process();
     _process.StartInfo = new ProcessStartInfo(_executable, _parameters);
     _process.StartInfo.CreateNoWindow = true;
     _process.StartInfo.UseShellExecute = true;
     _process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
     _process.Start();
     listenForModifications();
     Thread.Sleep(500);
     _isInitialized = true;
     GoTo(location);
 }
Ejemplo n.º 7
0
 public void GoTo(Location location)
 {
     if (location == null)
         return;
     var id = getBufferID(location.File);
     if (id == -1)
         id = editFile(location.File);
     goTo(id, location);
 }
Ejemplo n.º 8
0
 // Launch the editor and if not null go to location
 public void Initialize(Location location, string[] args)
 {
     _isAlive = true;
     Publisher.Run("test-editor started");
 }
Ejemplo n.º 9
0
 public void GoTo(Location location)
 {
     var msg = string.Format(
         "goto \"{0}\" {1} {2}",
         location.File,
         location.Line,
         location.Column);
     send(msg);
 }
Ejemplo n.º 10
0
 public void GoTo(Location location)
 {
     invoke("{0} +{1}", location.File, location.Line);
 }
Ejemplo n.º 11
0
 public void Initialize(Location location, string[] args)
 {
     openConfiguration();
     appendArguments(args);
     if (_launchCommand != null) {
         runCommand(
             _launchCommand.Executable,
             _launchCommand.Parameter,
             true);
     }
     Logger.Write("emacs plugin started");
     _startupGraceTime = DateTime.Now.AddSeconds(5);
 }
Ejemplo n.º 12
0
 public void GoTo(Location location, string window)
 {
     var msg = string.Format(
         "goto \"{0}\" {1} {2} {3}",
         location.File,
         location.Line,
         location.Column,
         window);
     send(msg);
 }
Ejemplo n.º 13
0
        public void Insert(EditorInsertMessage message)
        {
            var origin = getLocation();
            GoTo(new Location(
                message.Destination.File,
                message.Destination.Line,
                message.Destination.Column));
            var location = getLocation();
            if (location == null)
                return;
            var newline = "\\n";
            if (Environment.OSVersion.Platform != PlatformID.Unix &&
                Environment.OSVersion.Platform != PlatformID.MacOSX)
                newline = "\\r\\n";
            var content = getText(location.Buffer.ID);
            if (content == null)
                return;
            var lines = content.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
            if (lines.Length < location.Line)
            {
                Logger.Write("Asked for line {0} but document only contained {1} lines",
                    location.Line,
                    lines.Length);
                return;
            }
            var line = lines[location.Line - 1];
            if (line.Length < location.Column)
            {
                Logger.Write("Asked for column {0} but line was only {1} chars long",
                    location.Column,
                    line);
                return;
            }

            Logger.Write("Line is: " + line);
            var removeLength = line.Length - message.Destination.Column + 1;
            if (removeLength > line.Length)
                removeLength = line.Length;
            var insertColumn = location.Column; // + ((message.Destination.Column - 1) - location.Column);
            var textModified =
                message.Text
                    .Replace("\\", "\\\\")
                    .Replace("\"", "\\\"")
                    .Replace(Environment.NewLine, newline) +
                line.Substring(insertColumn, removeLength);
            //send("{0}:remove/0 {1} {2}",
            //	location.Buffer.ID,
            //	location.Offset - location.Column,
            //	length - 1);
            //send("{0}:insert/0 {1} \"{2}\"",
            //	location.Buffer.ID,
            //	location.Offset - location.Column,
            //	lineModified);
            send("{0}:remove/0 {1} {2}",
                location.Buffer.ID,
                location.Offset,
                removeLength);
            send("{0}:insert/0 {1} \"{2}\"",
                location.Buffer.ID,
                location.Offset,
                textModified);
            if (message.MoveOffset != null)
            {
                var offsetLocation = new Location(
                    message.Destination.File,
                    message.Destination.Line,
                    message.Destination.Column);
                offsetLocation.Add(message.MoveOffset);
                GoTo(offsetLocation);
            }
            else
            {
                if (origin == null)
                    return;
                var originAdjusted = origin.Line;
                if (origin.Line > message.Destination.Line) {
                    originAdjusted =
                        origin.Line +
                        message.Text.Split(new[] {Environment.NewLine}, StringSplitOptions.None).Length;
                }
                GoTo(new Location(
                    origin.Buffer.Fullpath,
                    origin.Line,
                    origin.Column));
            }
        }
Ejemplo n.º 14
0
 public void Initialize(Location location, string[] args)
 {
     openConfiguration();
     appendArguments(args);
     if (_launchCommand == null)
         return;
     runCommand(
         _launchCommand.Executable,
         _launchCommand.Parameter,
         true);
     loadProject(projectFromArgs(ArgumentParser.Parse(args).ToArray()));
     Logger.Write("sublime started");
     _startupGraceTime = DateTime.Now.AddSeconds(5);
 }
Ejemplo n.º 15
0
 public void Initialize(Location location, string[] args)
 {
     openConfiguration();
     appendArguments(args);
     if (_launchCommand == null)
         return;
     var proc = runCommand(
         _launchCommand.Executable,
         _launchCommand.Parameter,
         true);
     _startupGraceTime = DateTime.Now.AddSeconds(5);
 }
 public void GoTo(Location location)
 {
     GoTo(location, null);
 }
 public void Initialize(Location location, string[] args)
 {
     tryOpenConfiguration();
     if (_launchCommand == null)
         return;
     runCommand(
         _launchCommand.Executable,
         _launchCommand.Parameter,
         true);
     Thread.Sleep(500);
     if (location != null)
         GoTo(location);
     _isInitialized = true;
 }
 public void GoTo(Location location, string window)
 {
     invoke("{0} +{1}", location.File, location.Line);
 }