当前位置: 首页>>代码示例>>Python>>正文


Python sublime.INHIBIT_EXPLICIT_COMPLETIONS属性代码示例

本文整理汇总了Python中sublime.INHIBIT_EXPLICIT_COMPLETIONS属性的典型用法代码示例。如果您正苦于以下问题:Python sublime.INHIBIT_EXPLICIT_COMPLETIONS属性的具体用法?Python sublime.INHIBIT_EXPLICIT_COMPLETIONS怎么用?Python sublime.INHIBIT_EXPLICIT_COMPLETIONS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在sublime的用法示例。


在下文中一共展示了sublime.INHIBIT_EXPLICIT_COMPLETIONS属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: complete_package_objects

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import INHIBIT_EXPLICIT_COMPLETIONS [as 别名]
def complete_package_objects(self, view, pt):
        line = self.extract_line(view, pt, truncated=True)
        m = VALIDOBJECT.search(line)
        if not m:
            return []
        pkg, delim, prefix = m.groups()

        if delim == "::":
            completions = self.get_completions_for_package(
                pkg, exported_only=True)
        elif delim == ":::":
            completions = self.get_completions_for_package(
                pkg, exported_only=False)
        else:
            return []

        completions = [(item, ) for item in completions
                       if item.startswith(prefix)]
        return (completions, sublime.INHIBIT_WORD_COMPLETIONS
                | sublime.INHIBIT_EXPLICIT_COMPLETIONS) 
开发者ID:randy3k,项目名称:R-Box,代码行数:22,代码来源:completion.py

示例2: on_query_completions

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import INHIBIT_EXPLICIT_COMPLETIONS [as 别名]
def on_query_completions(self, view, prefix, locations):
        '''Sublime Text autocompletion event handler'''
        filetype = lang(view)
        if filetype is None or view.is_scratch():
            return

        print("[YCMD] #### START COMPLETION ####")

        if self.ready_from_defer is True:
            cpl = self.completions
            self.completions = []
            self.ready_from_defer = False
            return (cpl, sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS)

        filepath = get_file_path()
        row, col = view.rowcol(locations[0])
        content = view.substr(sublime.Region(0, view.size()))
        t = Thread(None, complete_func, 'CompleteAsync',
                   [filepath, row, col, content, self._on_errors, self._complete, filetype])
        t.daemon = True
        t.start() 
开发者ID:LuckyGeck,项目名称:YcmdCompletion,代码行数:23,代码来源:Completion.py

示例3: on_query_completions

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import INHIBIT_EXPLICIT_COMPLETIONS [as 别名]
def on_query_completions(self, view, prefix, locations):
        # parts of the code inspired by: https://github.com/agibsonsw/AndyPython/blob/master/PythonCompletions.py
        global builtin_compl_vars, builtin_compl_funcs, magic_control_pars
        if not view.match_selector(locations[0], 'source.ksp -string -comment -constant'):
            return []
        pt = locations[0] # - len(prefix) - 1
        line_start_pos = view.line(sublime.Region(pt, pt)).begin()
        line = view.substr(sublime.Region(line_start_pos, pt))    # the character before the trigger

        if re.match(r' *declare .*', line) and ':=' not in line:
            compl = []
        elif re.match(r'.*-> ?[a-zA-Z_]*$', line): # if the line ends with something like '->' or '->valu'
            compl = magic_control_pars
        else:
            compl = self._extract_completions(view, prefix, pt)
            compl = [(item + "\tdefault", item.replace('$', '\\$', 1)) for item in compl
                     if len(item) > 3 and item not in all_builtins]
            if '.' not in prefix:
                bc = []
                bc.extend(builtin_compl_vars)
                bc.extend(builtin_compl_funcs)
                compl.extend(bc)
        compl = self.unique(compl)

        return (compl, sublime.INHIBIT_WORD_COMPLETIONS |
                sublime.INHIBIT_EXPLICIT_COMPLETIONS) 
开发者ID:nojanath,项目名称:SublimeKSP,代码行数:28,代码来源:ksp_plugin.py

示例4: on_query_completions

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import INHIBIT_EXPLICIT_COMPLETIONS [as 别名]
def on_query_completions(self, view, prefix, locations):
        # Check if this is a Rust source file. This check
        # relies on the Rust syntax formatting extension
        # being installed - https://github.com/jhasse/sublime-rust
        if view.match_selector(locations[0], "source.rust"):
            # Get the buffer location in correct format for racer
            row, col = view.rowcol(locations[0])
            row += 1

            try:
                raw_results = run_racer(view, ["complete-with-snippet", str(row), str(col)])
            except FileNotFoundError:
                print("Unable to find racer executable (check settings)")
                return

            results = []
            lalign = 0;
            ralign = 0;
            for result in raw_results:
                result.middle = "{0} ({1})".format(result.type, os.path.basename(result.path))
                lalign = max(lalign,len(result.completion)+len(result.middle))
                ralign = max(ralign, len(result.context))

            for result in raw_results:
                context = result.context
                result = "{0} {1:>{3}} : {2:{4}}".format(result.completion, result.middle, result.context, lalign - len(result.completion), ralign), result.snippet
                results.append(result)
            if len(results) > 0:
                # return list(set(results))
                return (list(set(results)),
                        sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS) 
开发者ID:defuz,项目名称:RustAutoComplete,代码行数:33,代码来源:RustAutoComplete.py

示例5: on_query_completions

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import INHIBIT_EXPLICIT_COMPLETIONS [as 别名]
def on_query_completions(self, view, prefix, locations):
        """Runs on all views, but is NOOP unless view is response view or history
        view. Inside gql query string, only completions returned by this method
        are shown.
        """
        response_view = view.settings().get('requester.response_view', False)
        history_view = view.settings().get('requester.history_view', False)
        if not response_view and not history_view:
            return None

        content = view.substr(sublime.Region(0, view.size()))
        m = re.search(r'\bgql\s*=\s*("|\')+', content)
        if m is None:
            return None

        offset, idx = m.end(), view.sel()[0].begin()

        try:
            request = parse_requests(content, n=1)[0]

            if getattr(view, '_env', None) is None:
                view._env = RequestCommandMixin.get_env_dict_from_string(
                    view.settings().get('requester.env_string', None)
                )
            req = prepare_request(request, view._env, 1)

            schema = view.settings().get('requester.gql_schema', None)
            if not schema:  # let user know schema is being retrieved
                set_graphql_schema_on_view(view, req)
                raise Exception('Loading GraphQL schema info')

            gql = req.skwargs['gql']
            completions = get_completions(gql, idx-offset, schema)
            return completions
        except Exception as e:
            print('GraphQL Error:')
            traceback.print_exc(file=sys.stdout)
            return (
                [[str(e), ' '], ['...', ' ']],
                sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS
            ) 
开发者ID:kylebebak,项目名称:Requester,代码行数:43,代码来源:graphql.py

示例6: get_completions

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import INHIBIT_EXPLICIT_COMPLETIONS [as 别名]
def get_completions(gql, idx, schema):
    """Creates AST from `gql` query string, finds out exactly where cursor is in
    string, and uses `schema` to get appropriate completions. Doesn't protect
    against exceptions. They should be handled by calling code.
    """
    start, end = slurp_word(gql, idx)
    gql_parser = GraphQLParser()
    ast = gql_parser.parse(gql[:start] + placeholder + gql[end:], lexer=GraphQLLexer())

    for query in ast.definitions:  # get path if it exists
        path = placeholder_path(query, placeholder)
        if path is not None:
            break

    query_type, types = schema
    t = resolve_type(path, types, query_type)
    fields = types[t]['fields']

    completions = []
    for f in fields.values():
        name = f['name']
        args = [a['name'] + ':' for a in f['args']]
        args_string = '({})'.format(', '.join(args)) if args else ''
        type_name = resolve_field_type(f)
        completions.append([
            '{}{}\t{}'.format(name, args_string, type_name),
            '{}{}'.format(name, args_string),
        ])

    return (
        completions,
        sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS
    ) 
开发者ID:kylebebak,项目名称:Requester,代码行数:35,代码来源:graphql.py

示例7: on_query_completions

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import INHIBIT_EXPLICIT_COMPLETIONS [as 别名]
def on_query_completions(self, prefix: str, locations: List[int]) -> Optional[Tuple[List[Tuple[str, str]], int]]:
        if not self.initialized:
            self.initialize()

        flags = 0
        if settings.only_show_lsp_completions:
            flags |= sublime.INHIBIT_WORD_COMPLETIONS
            flags |= sublime.INHIBIT_EXPLICIT_COMPLETIONS

        if self.enabled:
            if not self.match_selector(locations[0]):
                return ([], flags)

            reuse_completion = self.is_same_completion(prefix, locations)
            if self.state == CompletionState.IDLE:
                if not reuse_completion:
                    self.last_prefix = prefix
                    self.last_location = locations[0]
                    self.do_request(prefix, locations)
                    self.completions = []

            elif self.state in (CompletionState.REQUESTING, CompletionState.CANCELLING):
                if not reuse_completion:
                    self.next_request = (prefix, locations)
                    self.state = CompletionState.CANCELLING

            elif self.state == CompletionState.APPLYING:
                self.state = CompletionState.IDLE

            return (self.completions, flags)

        return None 
开发者ID:sublimelsp,项目名称:LSP,代码行数:34,代码来源:completion.py

示例8: on_query_completions

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import INHIBIT_EXPLICIT_COMPLETIONS [as 别名]
def on_query_completions(self, view, prefix, locations):
        '''
        Sublime Text autocompletion event handler.
        '''
        if not is_cpp(view) or view.is_scratch():
            return

        # if completion should begin
        leftchar = view.substr(locations[0] - 2)
        thischar = view.substr(locations[0] - 1)
        if thischar == '>' and leftchar != '-':
            return
        if thischar == ':' and leftchar != ':':
            return

        print("[C++YouCompleteMe] Start completing.")

        if self.ready_from_defer is True:
            cpl = self.completions
            self.completions = []
            self.ready_from_defer = False
            return (cpl, sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS)

        filepath = get_file_path(view.file_name())
        contents = view.substr(sublime.Region(0, view.size()))

        # get 1-based location
        row, col = get_row_col(view, locations[0])

        # start code-completion thread
        t = Thread(None, complete_func, 'CompleteAsync',
                   [server(), filepath, contents, row, col, self._complete])
        t.daemon = True
        t.start() 
开发者ID:glymehrvrd,项目名称:CppYCM,代码行数:36,代码来源:autocomplete.py

示例9: onQueryCompletion

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import INHIBIT_EXPLICIT_COMPLETIONS [as 别名]
def onQueryCompletion(self, view):
		if getSetting("fuse_completion") == False:
		 	return

		syntaxName = getSyntax(view)
		if not isSupportedSyntax(syntaxName):
		 	return

		self.doCompleteAttribs = getSetting("fuse_ux_attrib_completion")
		self.foldUXNameSpaces = getSetting("fuse_ux_attrib_folding")
		self.completionSyntax = syntaxName

		if self.lastResponse is None:
			self.requestAutoComplete(view, syntaxName, lambda res: self.responseAutoComplete(view, res))
			return ([("", "")], sublime.INHIBIT_WORD_COMPLETIONS)

		response = self.lastResponse
		self.lastResponse = None

		if response.status != "Success":
		 	return

		caret = view.sel()[0].a
		vstr = view.substr(caret)
		self.wordAtCaret = view.substr(view.word(caret)).strip()

		if vstr == "(" or vstr == "=" or vstr == "\"": 
			self.useShortCompletion = True
		else:
			self.useShortCompletion = False

		self.handleCodeSuggestion(response.data)
		
		data = (self.items, sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS)
		if len(self.items) == 0:
		 	if self.isUpdatingCache == True:
		 		return ([("Updating suggestion cache...", "_"), ("", "")], sublime.INHIBIT_WORD_COMPLETIONS)

		 	if getSetting("fuse_if_no_completion_use_sublime") == False:				
		 		return ([("", "")], sublime.INHIBIT_WORD_COMPLETIONS)
		 	else:
		 		return

		self.items = []
		return data 
开发者ID:fuse-open,项目名称:Fuse.SublimePlugin,代码行数:47,代码来源:fuse.py

示例10: on_query_completions

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import INHIBIT_EXPLICIT_COMPLETIONS [as 别名]
def on_query_completions(self, view, prefix, locations):
        """Sublime Text autocompletion event handler
        """

        if not is_code(view, lang='rust'):
            return

        if self.ready_from_defer is True:
            completion_flags = 0

            if ags(view, 'suppress_word_completions', False):
                completion_flags = sublime.INHIBIT_WORD_COMPLETIONS

            if ags(view, 'suppress_explicit_completions', False):
                completion_flags = sublime.INHIBIT_EXPLICIT_COMPLETIONS

            cpl = self.completions
            self.completions = []
            self.ready_from_defer = False

            return (cpl, completion_flags)

        code = view.substr(sublime.Region(0, view.size()))
        row, col = view.rowcol(locations[0])
        racer = get_settings(view, 'racer_binary_path', 'racer')
        if racer == '':
            racer = 'racer'

        data = {
            'vid': view.id(),
            'filename': view.file_name(),
            'settings': {
                'racer_binary_path': racer,
                'rust_src_path': get_settings(view, 'rust_src_path'),
                'row': row,
                'col': col,
                'source': code,
            },
            'method': 'autocomplete',
            'handler': 'racer'
        }
        Worker().execute(
            Callback(
                on_success=self._complete,
                on_failure=self._on_failure,
                on_timeout=self._on_timeout
            ),
            **data
        ) 
开发者ID:DamnWidget,项目名称:anaconda_rust,代码行数:51,代码来源:completion.py

示例11: on_query_completions_async

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import INHIBIT_EXPLICIT_COMPLETIONS [as 别名]
def on_query_completions_async(self, view, prefix, locations):
        self.completions = None

        flow_settings = find_flow_settings(view.window().project_data())
        autocomplete_flags = sublime.INHIBIT_WORD_COMPLETIONS | \
            sublime.INHIBIT_EXPLICIT_COMPLETIONS
        if flow_settings.get('show_sublime_autocomplete_suggestions'):
            autocomplete_flags = 0

        result = None
        try:
            result = CLI(view).autocomplete()
        except InvalidContext:
            pass
        except Exception as e:
            display_unknown_error(self.view, e)

        if not result:
            return

        self.completions = (
            [
                (
                    # matching text
                    match['name'] + '\t' + match['type'],
                    # inserted text
                    build_snippet(
                        match['name'],
                        match.get('func_details')['params']
                    )
                    if (
                        match.get('func_details') and
                        not flow_settings.get('omit_function_parameters')
                    )
                    else match['name']
                )
                for match in result['result']
            ],
            autocomplete_flags
        )
        self.completions_ready = True
        sublime.active_window().active_view().run_command(
            'hide_auto_complete'
        )
        self.run_auto_complete() 
开发者ID:tptee,项目名称:FlowIDE,代码行数:47,代码来源:autocomplete.py

示例12: on_query_completions

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import INHIBIT_EXPLICIT_COMPLETIONS [as 别名]
def on_query_completions(self, view, prefix, locations):

    if not view.match_selector(
        locations[0],
        'source.js - string - comment'
    ):
      return []

    scope = view.scope_name(view.sel()[0].begin()-1).strip()

    # added "keyword.operator.accessor.js" for JavaScript (Babel) support
    # added "punctuation.dollar.js" and startswith("$") for completions that starts with "$" char
    # because Sublime Text 3 doesn't recognize it
    # 
    # force prefix in case of presence of "$" char
    if scope.endswith(" punctuation.dollar.js"):
      prefix = "$"
    elif view.substr(util.word_with_dollar_char(view, view.sel()[0])).startswith("$"): 
      prefix = view.substr(util.word_with_dollar_char(view, view.sel()[0]))

    self.prefix = prefix
    self.locations = locations

    if not prefix and not (scope.endswith(" punctuation.accessor.js") or scope.endswith(" punctuation.dollar.js") or view.substr(util.word_with_dollar_char(view, view.sel()[0].begin()-1)).startswith("$") or scope.endswith(" keyword.operator.accessor.js")) :
      sublime.active_window().active_view().run_command(
        'hide_auto_complete'
      )
      return []

    if self.completions_ready and self.completions:
      self.completions_ready = False
      # Return the pending completions
      return self.completions

    if not self.searching:
      self.searching = True
      self.modified = False
    else: 
      return ([], sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS)

    sublime.set_timeout_async(
      lambda: self.on_query_completions_async(view)
    )

    if not self.completions_ready or not self.completions:
      return ([], sublime.INHIBIT_WORD_COMPLETIONS | sublime.INHIBIT_EXPLICIT_COMPLETIONS) 
开发者ID:pichillilorenzo,项目名称:JavaScriptEnhancements,代码行数:48,代码来源:completion.py

示例13: on_query_completions

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import INHIBIT_EXPLICIT_COMPLETIONS [as 别名]
def on_query_completions(self, view, prefix, locations):
        """Fired directly from Sublime Text 3 events systems
        """

        if not is_code(view, lang='go'):
            return

        if not go.ANAGONDA_PRESENT:
            if go.AVAILABLE:
                go.init()
            else:
                return

        if self.ready_from_defer is True:
            completion_flags = 0

            if get_settings(view, 'suppress_word_completions', False):
                completion_flags = sublime.INHIBIT_WORD_COMPLETIONS

            if get_settings(view, 'suppress_explicit_completions', False):
                completion_flags |= sublime.INHIBIT_EXPLICIT_COMPLETIONS

            cpl = self.completions
            self.completions = []
            self.ready_from_defer = False

            return (cpl, completion_flags)

        code = view.substr(sublime.Region(0, view.size()))
        row, col = view.rowcol(locations[0])
        data = {
            'vid': view.id(),
            'path': view.file_name(),
            'code': code,
            'offset': view.text_point(row, col),
            'add_params': get_settings(
                view, 'anaconda_go_add_completion_params', True),
            'go_env': {
                'GOROOT': go.GOROOT,
                'GOPATH': go.GOPATH,
                'CGO_ENABLED': go.CGO_ENABLED
            },
            'method': 'autocomplete',
            'handler': 'anaGonda'
        }
        Worker.execute(
            Callback(
                on_success=self._complete,
                on_failure=self._on_failure,
                on_timeout=self._on_timeout
            ),
            **data
        ) 
开发者ID:DamnWidget,项目名称:anaconda_go,代码行数:55,代码来源:autocompletion.py


注:本文中的sublime.INHIBIT_EXPLICIT_COMPLETIONS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。