Esempio n. 1
0
def handle_property_value_completions(view, location):
    scopes = util.get_scopes(view, location)

    # >>> scopes = ["source.css", "meta.property-value.width.css"]
    # >>> util.get_scope_that_starts_with(scopes, starts_with="meta.property-value.")
    # 'meta.property-value.width.css'
    scope = util.get_scope_that_starts_with(scopes, starts_with="meta.property-value.")

    # "meta.property-value.width.css" ->
    # ['meta', 'property-value', 'width', 'css']
    #                            name
    name_index = -2
    property_name = scope.split(".")[name_index]

    return properties.get_values(property_name)
Esempio n. 2
0
def handle_function_completions(view, location):
    scopes = util.get_scopes(view, location)

    # >>> scopes = ["source.css", "meta.function.ca.c.css"]
    # >>> util.get_scope_that_starts_with(scopes, starts_with="meta.function.")
    # 'meta.function.calc.css'
    scope = util.get_scope_that_starts_with(scopes, starts_with="meta.function.")

    # "meta.function.calc.css" ->
    # ["meta", "function", "calc", "css"]
    #                      name
    name_index = -2
    func_name = scope.split(".")[name_index]

    return functions.get_completions(func_name)
Esempio n. 3
0
def handle_descriptor_value_completions(view, location):
    scopes = util.get_scopes(view, location)

    # >>> scopes = ["source.css", "meta.descriptor.viewport.zoom.css"]
    # >>> util.get_scope_that_starts_with(scopes, starts_with="meta.descriptor.")
    # 'meta.descriptor.viewport.zoom.css'
    scope = util.get_scope_that_starts_with(scopes, starts_with="meta.descriptor.")

    # "meta.descriptor.viewport.zoom.css" ->
    # ['meta', 'descriptor', 'viewport', 'zoom', 'css']
    #                         type        name
    type_index, name_index = 2, 3
    descriptor_type, descriptor_name = scope.split(".")[type_index:name_index+1]

    return descriptors.get_values(descriptor_type, descriptor_name)
def handle_property_value_completions(view, location):
    scopes = util.get_scopes(view, location)

    # >>> scopes = ["source.css", "meta.property-value.width.css"]
    # >>> util.get_scope_that_starts_with(scopes, starts_with="meta.property-value.")
    # 'meta.property-value.width.css'
    scope = util.get_scope_that_starts_with(scopes, starts_with="meta.property-value.")

    # "meta.property-value.width.css" ->
    # ['meta', 'property-value', 'width', 'css']
    #                            name
    name_index = -2
    property_name = scope.split(".")[name_index]

    return properties.get_values(property_name)
def handle_function_completions(view, location):
    scopes = util.get_scopes(view, location)

    # >>> scopes = ["source.css", "meta.function.ca.c.css"]
    # >>> util.get_scope_that_starts_with(scopes, starts_with="meta.function.")
    # 'meta.function.calc.css'
    scope = util.get_scope_that_starts_with(scopes, starts_with="meta.function.")

    # "meta.function.calc.css" ->
    # ["meta", "function", "calc", "css"]
    #                      name
    name_index = -2
    func_name = scope.split(".")[name_index]

    return functions.get_completions(func_name)
def handle_descriptor_value_completions(view, location):
    scopes = util.get_scopes(view, location)

    # >>> scopes = ["source.css", "meta.descriptor.viewport.zoom.css"]
    # >>> util.get_scope_that_starts_with(scopes, starts_with="meta.descriptor.")
    # 'meta.descriptor.viewport.zoom.css'
    scope = util.get_scope_that_starts_with(scopes, starts_with="meta.descriptor.")

    # "meta.descriptor.viewport.zoom.css" ->
    # ['meta', 'descriptor', 'viewport', 'zoom', 'css']
    #                         type        name
    type_index, name_index = 2, 3
    descriptor_type, descriptor_name = scope.split(".")[type_index:name_index+1]

    return descriptors.get_values(descriptor_type, descriptor_name)