【问题标题】:PyCharm - getting cursor position from shellPyCharm - 从外壳获取光标位置
【发布时间】:2018-04-11 07:55:45
【问题描述】:

当我关闭并重新打开 PyCharm 项目时,最后一个文件和光标位置(行号和从行开始的字符数)被保留,因此它显然被保存在某个地方。

有没有办法从命令行访问这个光标位置数据?

【问题讨论】:

    标签: intellij-idea pycharm


    【解决方案1】:

    有关当前项目会话的全部信息存储在.idea/workspace.xml 文件中。我没有彻底检查,但这里是解决方案:

    $ xmllint .idea/workspace.xml --xpath '//project/component[@name="FileEditorManager"]/leaf/file[@leaf-file-name="PUT_YOUR_FILENAME_HERE"]/entry/provider/state/caret/@line'
    line="501"
    $ xmllint .idea/workspace.xml --xpath '//project/component[@name="FileEditorManager"]/leaf/file[@leaf-file-name="PUT_YOUR_FILENAME_HERE"]/entry/provider/state/caret/@column'
    column="12"
    

    【讨论】:

      猜你喜欢
      • 2022-10-05
      • 2016-04-17
      • 2016-02-09
      • 2011-09-19
      • 2018-06-17
      • 2012-05-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多