Add a new language named 'cmdsignature'
Add language 'cmdsignature' to enable syntax highlighting in builtin command's hover document
This commit is contained in:
parent
e6559bdc7c
commit
8fa5259d87
|
@ -28,6 +28,10 @@ function yamlToJson() {
|
||||||
if (isGrammarOutdate('cmakecache.tmLanguage.json')) {
|
if (isGrammarOutdate('cmakecache.tmLanguage.json')) {
|
||||||
execSync('npm run grammar-cmakecache');
|
execSync('npm run grammar-cmakecache');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isGrammarOutdate('cmdsignature.tmLanguage.json')) {
|
||||||
|
execSync('npm run grammar-cmdsignature');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
yamlToJson();
|
yamlToJson();
|
||||||
|
|
|
@ -27,6 +27,11 @@
|
||||||
"language": "cmakecache",
|
"language": "cmakecache",
|
||||||
"scopeName": "source.cmakecache",
|
"scopeName": "source.cmakecache",
|
||||||
"path": "./syntaxes/cmakecache.tmLanguage.json"
|
"path": "./syntaxes/cmakecache.tmLanguage.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language": "cmdsignature",
|
||||||
|
"scopeName": "source.cmdsignature",
|
||||||
|
"path": "./syntaxes/cmdsignature.tmLanguage.json"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"languages": [
|
"languages": [
|
||||||
|
@ -51,6 +56,9 @@
|
||||||
"aliases": [
|
"aliases": [
|
||||||
"CMakeCache"
|
"CMakeCache"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "cmdsignature"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"snippets": [
|
"snippets": [
|
||||||
|
@ -97,6 +105,7 @@
|
||||||
"vscode:prepublish": "npm run compile",
|
"vscode:prepublish": "npm run compile",
|
||||||
"grammar-cmake": "npx js-yaml ./syntaxes/cmake.tmLanguage.yml > ./syntaxes/cmake.tmLanguage.json",
|
"grammar-cmake": "npx js-yaml ./syntaxes/cmake.tmLanguage.yml > ./syntaxes/cmake.tmLanguage.json",
|
||||||
"grammar-cmakecache": "npx js-yaml ./syntaxes/cmakecache.tmLanguage.yml > ./syntaxes/cmakecache.tmLanguage.json",
|
"grammar-cmakecache": "npx js-yaml ./syntaxes/cmakecache.tmLanguage.yml > ./syntaxes/cmakecache.tmLanguage.json",
|
||||||
|
"grammar-cmdsignature": "npx js-yaml ./syntaxes/cmdsignature.tmLanguage.yml > ./syntaxes/cmdsignature.tmLanguage.json",
|
||||||
"grammar": "node ./build/yaml-to-json.mjs",
|
"grammar": "node ./build/yaml-to-json.mjs",
|
||||||
"compile": "npm run grammar && tsc -p ./",
|
"compile": "npm run grammar && tsc -p ./",
|
||||||
"watch": "npm run grammar && tsc -watch -p ./",
|
"watch": "npm run grammar && tsc -watch -p ./",
|
||||||
|
|
|
@ -63,13 +63,13 @@ patterns:
|
||||||
- name: keyword.control.cmake
|
- name: keyword.control.cmake
|
||||||
match: ^\s*\b(if|elif|else|endif|while|endwhile|break|continue|foreach|endforeach|return)\b
|
match: ^\s*\b(if|elif|else|endif|while|endwhile|break|continue|foreach|endforeach|return)\b
|
||||||
# unary tests operators
|
# unary tests operators
|
||||||
- name: keyword.operator.unary.cmake
|
- name: keyword.other.unary.cmake
|
||||||
match: \b(EXISTS|COMMAND|DEFINED)\b
|
match: \b(EXISTS|COMMAND|DEFINED)\b
|
||||||
# binary tests operators
|
# binary tests operators
|
||||||
- name: keyword.operator.binary.cmake
|
- name: keyword.other.binary.cmake
|
||||||
match: \b(EQUAL|LESS|LESS_EQUAL|GREATER|GREATER_EQUAL|STREQUAL|STRLESS|STRLESS_EQUAL|STRGREATER|STRGREATER_EQUAL|VERSION_EQUAL|VERSION_LESS|VERSION_LESS_EQUAL|VERSION_GREATER|VERSION_GREATER_EQUAL|MATCHES)\b
|
match: \b(EQUAL|LESS|LESS_EQUAL|GREATER|GREATER_EQUAL|STREQUAL|STRLESS|STRLESS_EQUAL|STRGREATER|STRGREATER_EQUAL|VERSION_EQUAL|VERSION_LESS|VERSION_LESS_EQUAL|VERSION_GREATER|VERSION_GREATER_EQUAL|MATCHES)\b
|
||||||
# logical operators
|
# logical operators
|
||||||
- name: keyword.operator.logical.cmake
|
- name: keyword.other.logical.cmake
|
||||||
match: \b(NOT|AND|OR)\b
|
match: \b(NOT|AND|OR)\b
|
||||||
# CACHE variable type
|
# CACHE variable type
|
||||||
- name: entity.name.type.cmake
|
- name: entity.name.type.cmake
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
fileTypes:
|
||||||
|
- cmdsignature
|
||||||
|
scopeName: source.cmdsignature
|
||||||
|
# a dictionary (i.e. key/value pairs) of rules which can be included from other
|
||||||
|
# places in the grammar. The key is the name of the rule and the value is the actual rule.
|
||||||
|
repository:
|
||||||
|
variable-reference:
|
||||||
|
name: variable.other.cmdsignature
|
||||||
|
begin: \$(ENV|CACHE)?{
|
||||||
|
beginCaptures:
|
||||||
|
"0": { name: punctuation.definition.variable-ref.start.cmdsignature }
|
||||||
|
end: "}"
|
||||||
|
endCaptures:
|
||||||
|
"0": { name: punctuation.definition.variable-ref.end.cmdsignature }
|
||||||
|
patterns:
|
||||||
|
- include: "#variable-reference"
|
||||||
|
generator-expression:
|
||||||
|
name: variable.other.cmdsignature
|
||||||
|
begin: \$\<
|
||||||
|
beginCaptures:
|
||||||
|
"0": { name: punctuation.definition.generator-exp.start.cmdsignature }
|
||||||
|
end: \>
|
||||||
|
endCaptures:
|
||||||
|
"0": { name: punctuation.definition.generator-exp.end.cmdsignature }
|
||||||
|
patterns:
|
||||||
|
- include: "#generator-expression"
|
||||||
|
|
||||||
|
patterns:
|
||||||
|
# string
|
||||||
|
- name: string.quoted.double.cmdsignature
|
||||||
|
begin: '"'
|
||||||
|
end: '"'
|
||||||
|
patterns:
|
||||||
|
- include: "#variable-reference"
|
||||||
|
- include: "#generator-expression"
|
||||||
|
- name: constant.character.escape.cmdsignature
|
||||||
|
match: \\.
|
||||||
|
# variable reference
|
||||||
|
- include: "#variable-reference"
|
||||||
|
# generator expression
|
||||||
|
- include: "#generator-expression"
|
||||||
|
# command
|
||||||
|
- name: entity.name.function.cmdsignature
|
||||||
|
match: ^(cmake_host_system_information|cmake_language|cmake_minimum_required|cmake_parse_arguments|cmake_path|cmake_policy|configure_file|endfunction|endmacro|execute_process|file|find_file|find_library|find_package|find_path|find_program|function|get_cmake_property|get_directory_property|get_filename_component|get_property|include|include_guard|list|macro|mark_as_advanced|math|message|option|separate_arguments|set|set_directory_properties|set_property|site_name|string|unset|variable_watch|add_compile_definitions|add_compile_options|add_custom_command|add_custom_target|add_definitions|add_dependencies|add_executable|add_library|add_link_options|add_subdirectory|add_test|aux_source_directory|build_command|create_test_sourcelist|define_property|enable_language|enable_testing|export|fltk_wrap_ui|get_source_file_property|get_target_property|get_test_property|include_directories|include_external_msproject|include_regular_expression|install|link_directories|link_libraries|load_cache|project|remove_definitions|set_source_files_properties|set_target_properties|set_tests_properties|source_group|target_compile_definitions|target_compile_features|target_compile_options|target_include_directories|target_link_directories|target_link_libraries|target_link_options|target_precompile_headers|target_sources|try_compile|try_run|ctest_build|ctest_configure|ctest_coverage|ctest_empty_binary_directory|ctest_memcheck|ctest_read_custom_files|ctest_run_script|ctest_sleep|ctest_start|ctest_submit|ctest_test|ctest_update|ctest_upload)\b
|
||||||
|
# Deprecated Commands
|
||||||
|
- name: invalid.deprecated.command.cmdsignature
|
||||||
|
match: ^(build_name|exec_program|export_library_dependencies|install_files|install_programs|install_targets|load_command|make_directory|output_required_files|qt_wrap_cpp|qt_wrap_ui|remove|subdir_depends|subdirs|use_mangled_mesa|utility_source|variable_requires|write_file)\b
|
||||||
|
# flow control commands in cmake
|
||||||
|
- name: keyword.control.cmdsignature
|
||||||
|
match: ^(if|elif|else|endif|while|endwhile|break|continue|foreach|endforeach|return)\b
|
||||||
|
# unary tests operators
|
||||||
|
- name: keyword.other.unary.cmdsignature
|
||||||
|
match: \b(EXISTS|COMMAND|DEFINED)\b
|
||||||
|
# binary tests operators
|
||||||
|
- name: keyword.other.binary.cmdsignature
|
||||||
|
match: \b(EQUAL|LESS|LESS_EQUAL|GREATER|GREATER_EQUAL|STREQUAL|STRLESS|STRLESS_EQUAL|STRGREATER|STRGREATER_EQUAL|VERSION_EQUAL|VERSION_LESS|VERSION_LESS_EQUAL|VERSION_GREATER|VERSION_GREATER_EQUAL|MATCHES)\b
|
||||||
|
# logical operators
|
||||||
|
- name: keyword.other.logical.cmdsignature
|
||||||
|
match: \b(NOT|AND|OR)\b
|
||||||
|
# bool constant
|
||||||
|
- name: constant.language.bool.cmake
|
||||||
|
match: \b(ON|YES|TRUE|Y|OFF|NO|FALSE|N|IGNORE|NOTFOUND|\w*-NOTFOUND)\b
|
||||||
|
# CACHE variable type
|
||||||
|
- name: entity.name.type.cmdsignature
|
||||||
|
match: \b(BOOL|FILEPATH|PATH|STRING|INTERNAL)\b
|
||||||
|
# bool constant
|
||||||
|
- name: constant.language.bool.cmdsignature
|
||||||
|
match: \b(?i:ON|YES|TRUE|Y|OFF|NO|FALSE|N|IGNORE|NOTFOUND|\w*-NOTFOUND)\b
|
||||||
|
# keyword
|
||||||
|
- name: keyword.other.cmdsignature
|
||||||
|
match: \b[A-Z0-9_]+\b
|
Loading…
Reference in New Issue