ctrl+shift+p filters: :st2 :st3 :win :osx :linux
浏览

上下文

shagabutdinov 所有

插件上下文检查

详细信息

安装数

  • 总计 2K
  • Win 1K
  • Mac 403
  • Linux 443
8月6日 8月5日 8月4日 8月3日 8月2日 8月1日 7月31日 7月30日 7月29日 7月28日 7月27日 7月26日 7月25日 7月24日 7月23日 7月22日 7月21日 7月20日 7月19日 7月18日 7月17日 7月16日 7月15日 7月14日 7月13日 7月12日 7月11日 7月10日 7月9日 7月8日 7月7日 7月6日 7月5日 7月4日 7月3日 7月2日 7月1日 6月30日 6月29日 6月28日 6月27日 6月26日 6月25日 6月24日 6月23日
Windows 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0
Mac 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
012348月6日8月3日7月31日7月28日7月25日7月22日7月19日7月16日7月13日7月10日7月7日7月4日7月1日6月28日6月25日8月6日 Linux: 0 Mac: 1 Windows: 08月5日 Linux: 0 Mac: 1 Windows: 08月4日 Linux: 0 Mac: 0 Windows: 08月3日 Linux: 0 Mac: 0 Windows: 08月2日 Linux: 0 Mac: 0 Windows: 08月1日 Linux: 0 Mac: 0 Windows: 07月31日 Linux: 0 Mac: 0 Windows: 07月30日 Linux: 0 Mac: 0 Windows: 17月29日 Linux: 0 Mac: 0 Windows: 07月28日 Linux: 0 Mac: 0 Windows: 17月27日 Linux: 0 Mac: 0 Windows: 07月26日 Linux: 0 Mac: 0 Windows: 07月25日 Linux: 0 Mac: 1 Windows: 07月24日 Linux: 0 Mac: 0 Windows: 07月23日 Linux: 0 Mac: 0 Windows: 07月22日 Linux: 0 Mac: 1 Windows: 07月21日 Linux: 0 Mac: 0 Windows: 07月20日 Linux: 0 Mac: 0 Windows: 07月19日 Linux: 0 Mac: 0 Windows: 07月18日 Linux: 0 Mac: 0 Windows: 07月17日 Linux: 0 Mac: 0 Windows: 07月16日 Linux: 0 Mac: 0 Windows: 07月15日 Linux: 0 Mac: 0 Windows: 07月14日 Linux: 0 Mac: 0 Windows: 07月13日 Linux: 0 Mac: 0 Windows: 07月12日 Linux: 0 Mac: 0 Windows: 07月11日 Linux: 0 Mac: 0 Windows: 07月10日 Linux: 0 Mac: 0 Windows: 07月9日 Linux: 0 Mac: 0 Windows: 07月8日 Linux: 0 Mac: 1 Windows: 07月7日 Linux: 0 Mac: 0 Windows: 07月6日 Linux: 0 Mac: 0 Windows: 17月5日 Linux: 0 Mac: 0 Windows: 07月4日 Linux: 0 Mac: 0 Windows: 17月3日 Linux: 0 Mac: 0 Windows: 17月2日 Linux: 0 Mac: 0 Windows: 07月1日 Linux: 0 Mac: 0 Windows: 06月30日 Linux: 0 Mac: 0 Windows: 06月29日 Linux: 0 Mac: 0 Windows: 06月28日 Linux: 0 Mac: 0 Windows: 06月27日 Linux: 0 Mac: 0 Windows: 06月26日 Linux: 0 Mac: 0 Windows: 06月25日 Linux: 0 Mac: 0 Windows: 06月24日 Linux: 0 Mac: 0 Windows: 06月23日 Linux: 0 Mac: 0 Windows: 08月6日 Linux: 0 Mac: 1 Windows: 08月5日 Linux: 0 Mac: 1 Windows: 08月4日 Linux: 0 Mac: 0 Windows: 08月3日 Linux: 0 Mac: 0 Windows: 08月2日 Linux: 0 Mac: 0 Windows: 08月1日 Linux: 0 Mac: 0 Windows: 07月31日 Linux: 0 Mac: 0 Windows: 07月30日 Linux: 0 Mac: 0 Windows: 17月29日 Linux: 0 Mac: 0 Windows: 07月28日 Linux: 0 Mac: 0 Windows: 17月27日 Linux: 0 Mac: 0 Windows: 07月26日 Linux: 0 Mac: 0 Windows: 07月25日 Linux: 0 Mac: 1 Windows: 07月24日 Linux: 0 Mac: 0 Windows: 07月23日 Linux: 0 Mac: 0 Windows: 07月22日 Linux: 0 Mac: 1 Windows: 07月21日 Linux: 0 Mac: 0 Windows: 07月20日 Linux: 0 Mac: 0 Windows: 07月19日 Linux: 0 Mac: 0 Windows: 07月18日 Linux: 0 Mac: 0 Windows: 07月17日 Linux: 0 Mac: 0 Windows: 07月16日 Linux: 0 Mac: 0 Windows: 07月15日 Linux: 0 Mac: 0 Windows: 07月14日 Linux: 0 Mac: 0 Windows: 07月13日 Linux: 0 Mac: 0 Windows: 07月12日 Linux: 0 Mac: 0 Windows: 07月11日 Linux: 0 Mac: 0 Windows: 07月10日 Linux: 0 Mac: 0 Windows: 07月9日 Linux: 0 Mac: 0 Windows: 07月8日 Linux: 0 Mac: 1 Windows: 07月7日 Linux: 0 Mac: 0 Windows: 07月6日 Linux: 0 Mac: 0 Windows: 17月5日 Linux: 0 Mac: 0 Windows: 07月4日 Linux: 0 Mac: 0 Windows: 17月3日 Linux: 0 Mac: 0 Windows: 17月2日 Linux: 0 Mac: 0 Windows: 07月1日 Linux: 0 Mac: 0 Windows: 06月30日 Linux: 0 Mac: 0 Windows: 06月29日 Linux: 0 Mac: 0 Windows: 06月28日 Linux: 0 Mac: 0 Windows: 06月27日 Linux: 0 Mac: 0 Windows: 06月26日 Linux: 0 Mac: 0 Windows: 06月25日 Linux: 0 Mac: 0 Windows: 06月24日 Linux: 0 Mac: 0 Windows: 06月23日 Linux: 0 Mac: 0 Windows: 08月6日 Linux: 0 Mac: 1 Windows: 08月5日 Linux: 0 Mac: 1 Windows: 08月4日 Linux: 0 Mac: 0 Windows: 08月3日 Linux: 0 Mac: 0 Windows: 08月2日 Linux: 0 Mac: 0 Windows: 08月1日 Linux: 0 Mac: 0 Windows: 07月31日 Linux: 0 Mac: 0 Windows: 07月30日 Linux: 0 Mac: 0 Windows: 17月29日 Linux: 0 Mac: 0 Windows: 07月28日 Linux: 0 Mac: 0 Windows: 17月27日 Linux: 0 Mac: 0 Windows: 07月26日 Linux: 0 Mac: 0 Windows: 07月25日 Linux: 0 Mac: 1 Windows: 07月24日 Linux: 0 Mac: 0 Windows: 07月23日 Linux: 0 Mac: 0 Windows: 07月22日 Linux: 0 Mac: 1 Windows: 07月21日 Linux: 0 Mac: 0 Windows: 07月20日 Linux: 0 Mac: 0 Windows: 07月19日 Linux: 0 Mac: 0 Windows: 07月18日 Linux: 0 Mac: 0 Windows: 07月17日 Linux: 0 Mac: 0 Windows: 07月16日 Linux: 0 Mac: 0 Windows: 07月15日 Linux: 0 Mac: 0 Windows: 07月14日 Linux: 0 Mac: 0 Windows: 07月13日 Linux: 0 Mac: 0 Windows: 07月12日 Linux: 0 Mac: 0 Windows: 07月11日 Linux: 0 Mac: 0 Windows: 07月10日 Linux: 0 Mac: 0 Windows: 07月9日 Linux: 0 Mac: 0 Windows: 07月8日 Linux: 0 Mac: 1 Windows: 07月7日 Linux: 0 Mac: 0 Windows: 07月6日 Linux: 0 Mac: 0 Windows: 17月5日 Linux: 0 Mac: 0 Windows: 07月4日 Linux: 0 Mac: 0 Windows: 17月3日 Linux: 0 Mac: 0 Windows: 17月2日 Linux: 0 Mac: 0 Windows: 07月1日 Linux: 0 Mac: 0 Windows: 06月30日 Linux: 0 Mac: 0 Windows: 06月29日 Linux: 0 Mac: 0 Windows: 06月28日 Linux: 0 Mac: 0 Windows: 06月27日 Linux: 0 Mac: 0 Windows: 06月26日 Linux: 0 Mac: 0 Windows: 06月25日 Linux: 0 Mac: 0 Windows: 06月24日 Linux: 0 Mac: 0 Windows: 06月23日 Linux: 0 Mac: 0 Windows: 0

说明书

源代码
raw.​githubusercontent.​com

上下文

这是一个低级别插件,为其他插件提供“检查上下文”功能,就像.sublime-keymap中的“上下文”部分一样工作。

它还提供了一些基本上下文,可以与该库或.sublime-keymap文件一起使用。以下列表了这些上下文。

安装

此插件是sublime-enhanced插件集的一部分。您可以安装sublime-enhanced,此插件将自动安装。

如果您想单独安装此软件包,请参阅sublime-enhanced软件包的“单独安装软件包”部分。

依赖

API

context.check(view, context)

在给定的视图中检查给定的上下文。如果传递给数组的任何一个上下文返回false,则调用的结果将为false。如果没有找到上下文键,将引发异常。

  • view - view (sublime.View) 应在其中检查上下文

  • context - 字典数组,格式如下

    [
      {
        "key": key,
        "operator": operator,
        "operand": value,
        "match_all" true/false,
      },
    
      {
        "key": key,
        "operator": operator,
        "operand": value,
      },
    
      // ...
    ]
    
  • key - 上下文键(字符串),将由相应的插件检查;请参阅上下文提供程序插件以了解可以传递给此参数的哪些键

  • operator - 可以是以下值的字符串:'equal', 'not_equal', 'regex_match', 'not_regex_match', 'regex_contains', 'not_regex_contains'

  • operand - 应将该值应用于键和运算符

  • match_all - 匹配具有提供上下文的所有光标或其中一个即可

示例

from Context import context

class TestCommand(sublime_plugin.TextCommand):
  def run(self, edit):
    is_python_file = {
      "key": "file_name",
      "operator": "regex_contains",
      "operand": "py$",
    }

    is_file_in_tests = {
      "key": "file_name",
      "operator": "regex_contains",
      "operand": "/tests/",
    }

    if context.check(self.view, [is_python_file, is_file_in_tests]):
      print("This file is python file in tests directory!")

提供上下文字符

  • 文件名 - 文件名与提供的正则表达式匹配
  • 选择为空 - 选择为空
  • 选择.b大于或等于a - sel.b >= sel.a
  • 选择.b大于a - sel.b > sel.a
  • 选择.b小于或等于a - sel.b <= sel.a
  • 选择.b小于a - sel.b < sel.a
  • line_b - 包含 sel.b 的行:view.substr(view.line(sel.b))
  • following_text_a - 从 sel.a 到行尾的文本
  • following_text_b - 从 sel.b 到行尾的文本
  • following_text_begin - 从 min(sel.a, sel.b) 到行尾的文本
  • following_text_end - 从 max(sel.a, sel.b) 到行尾的文本
  • preceding_text_a - 在 a 之前到行首的文本
  • preceding_text_b - 在 b 之前到行首的文本
  • preceding_text_begin - 在 min(sel.a, sel.b) 之前到行首的文本
  • preceding_text_end - 在 max(sel.a, sel.b) 之前到行首的文本

冲突

  • 北极类型脚本 - 它定义了具有不同工作方式的相同上下文值