mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Merge commit 'ac998a74b3
' into sync-from-ra
This commit is contained in:
parent
d33d8675d0
commit
6b17dba68c
178 changed files with 7101 additions and 1965 deletions
|
@ -12,3 +12,6 @@
|
|||
!ra_syntax_tree.tmGrammar.json
|
||||
!server
|
||||
!README.md
|
||||
!language-configuration-rustdoc.json
|
||||
!rustdoc-inject.json
|
||||
!rustdoc.json
|
||||
|
|
37
editors/code/language-configuration-rustdoc.json
Normal file
37
editors/code/language-configuration-rustdoc.json
Normal file
|
@ -0,0 +1,37 @@
|
|||
{
|
||||
"comments": {
|
||||
"blockComment": ["<!--", "-->"]
|
||||
},
|
||||
"brackets": [
|
||||
["{", "}"],
|
||||
["[", "]"],
|
||||
["(", ")"]
|
||||
],
|
||||
"colorizedBracketPairs": [],
|
||||
"autoClosingPairs": [
|
||||
{ "open": "{", "close": "}" },
|
||||
{ "open": "[", "close": "]" },
|
||||
{ "open": "(", "close": ")" }
|
||||
],
|
||||
"surroundingPairs": [
|
||||
["(", ")"],
|
||||
["[", "]"],
|
||||
["`", "`"],
|
||||
["_", "_"],
|
||||
["*", "*"],
|
||||
["{", "}"],
|
||||
["'", "'"],
|
||||
["\"", "\""]
|
||||
],
|
||||
"folding": {
|
||||
"offSide": true,
|
||||
"markers": {
|
||||
"start": "^\\s*<!--\\s*#?region\\b.*-->",
|
||||
"end": "^\\s*<!--\\s*#?endregion\\b.*-->"
|
||||
}
|
||||
},
|
||||
"wordPattern": {
|
||||
"pattern": "(\\p{Alphabetic}|\\p{Number}|\\p{Nonspacing_Mark})(((\\p{Alphabetic}|\\p{Number}|\\p{Nonspacing_Mark})|[_])?(\\p{Alphabetic}|\\p{Number}|\\p{Nonspacing_Mark}))*",
|
||||
"flags": "ug"
|
||||
}
|
||||
}
|
|
@ -68,7 +68,9 @@
|
|||
"typescript": "^5.1.6"
|
||||
},
|
||||
"activationEvents": [
|
||||
"workspaceContains:Cargo.toml",
|
||||
"workspaceContains:*/Cargo.toml",
|
||||
"workspaceContains:rust-project.json",
|
||||
"workspaceContains:*/rust-project.json"
|
||||
],
|
||||
"main": "./out/main",
|
||||
|
@ -588,7 +590,7 @@
|
|||
},
|
||||
"rust-analyzer.cargo.buildScripts.rebuildOnSave": {
|
||||
"markdownDescription": "Rerun proc-macros building/build-scripts running when proc-macro\nor build-script sources change and are saved.",
|
||||
"default": false,
|
||||
"default": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"rust-analyzer.cargo.buildScripts.useRustcWrapper": {
|
||||
|
@ -775,7 +777,7 @@
|
|||
]
|
||||
},
|
||||
"rust-analyzer.check.overrideCommand": {
|
||||
"markdownDescription": "Override the command rust-analyzer uses instead of `cargo check` for\ndiagnostics on save. The command is required to output json and\nshould therefore include `--message-format=json` or a similar option\n(if your client supports the `colorDiagnosticOutput` experimental\ncapability, you can use `--message-format=json-diagnostic-rendered-ansi`).\n\nIf you're changing this because you're using some tool wrapping\nCargo, you might also want to change\n`#rust-analyzer.cargo.buildScripts.overrideCommand#`.\n\nIf there are multiple linked projects/workspaces, this command is invoked for\neach of them, with the working directory being the workspace root\n(i.e., the folder containing the `Cargo.toml`). This can be overwritten\nby changing `#rust-analyzer.check.invocationStrategy#` and\n`#rust-analyzer.check.invocationLocation#`.\n\nAn example command would be:\n\n```bash\ncargo check --workspace --message-format=json --all-targets\n```\n.",
|
||||
"markdownDescription": "Override the command rust-analyzer uses instead of `cargo check` for\ndiagnostics on save. The command is required to output json and\nshould therefore include `--message-format=json` or a similar option\n(if your client supports the `colorDiagnosticOutput` experimental\ncapability, you can use `--message-format=json-diagnostic-rendered-ansi`).\n\nIf you're changing this because you're using some tool wrapping\nCargo, you might also want to change\n`#rust-analyzer.cargo.buildScripts.overrideCommand#`.\n\nIf there are multiple linked projects/workspaces, this command is invoked for\neach of them, with the working directory being the workspace root\n(i.e., the folder containing the `Cargo.toml`). This can be overwritten\nby changing `#rust-analyzer.check.invocationStrategy#` and\n`#rust-analyzer.check.invocationLocation#`.\n\nIf `$saved_file` is part of the command, rust-analyzer will pass\nthe absolute path of the saved file to the provided command. This is\nintended to be used with non-Cargo build systems.\nNote that `$saved_file` is experimental and may be removed in the futureg.\n\nAn example command would be:\n\n```bash\ncargo check --workspace --message-format=json --all-targets\n```\n.",
|
||||
"default": null,
|
||||
"type": [
|
||||
"null",
|
||||
|
@ -902,6 +904,11 @@
|
|||
},
|
||||
"type": "object"
|
||||
},
|
||||
"rust-analyzer.completion.termSearch.enable": {
|
||||
"markdownDescription": "Whether to enable term search based snippets like `Some(foo.bar().baz())`.",
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"rust-analyzer.diagnostics.disabled": {
|
||||
"markdownDescription": "List of rust-analyzer diagnostics to disable.",
|
||||
"default": [],
|
||||
|
@ -1520,11 +1527,6 @@
|
|||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"rust-analyzer.rename.allowExternalItems": {
|
||||
"markdownDescription": "Allow renaming of items not belonging to the loaded workspaces.",
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"rust-analyzer.runnables.command": {
|
||||
"markdownDescription": "Command to be executed instead of 'cargo' for runnables.",
|
||||
"default": null,
|
||||
|
@ -1756,6 +1758,13 @@
|
|||
"rs"
|
||||
],
|
||||
"configuration": "language-configuration.json"
|
||||
},
|
||||
{
|
||||
"id": "rustdoc",
|
||||
"extensions": [
|
||||
".rustdoc"
|
||||
],
|
||||
"configuration": "./language-configuration-rustdoc.json"
|
||||
}
|
||||
],
|
||||
"grammars": [
|
||||
|
@ -1763,6 +1772,27 @@
|
|||
"language": "ra_syntax_tree",
|
||||
"scopeName": "source.ra_syntax_tree",
|
||||
"path": "ra_syntax_tree.tmGrammar.json"
|
||||
},
|
||||
{
|
||||
"language": "rustdoc",
|
||||
"scopeName": "text.html.markdown.rustdoc",
|
||||
"path": "rustdoc.json",
|
||||
"embeddedLanguages": {
|
||||
"meta.embedded.block.html": "html",
|
||||
"meta.embedded.block.markdown": "markdown",
|
||||
"meta.embedded.block.rust": "rust"
|
||||
}
|
||||
},
|
||||
{
|
||||
"injectTo": [
|
||||
"source.rust"
|
||||
],
|
||||
"scopeName": "comment.markdown-cell-inject.rustdoc",
|
||||
"path": "rustdoc-inject.json",
|
||||
"embeddedLanguages": {
|
||||
"meta.embedded.block.rustdoc": "rustdoc",
|
||||
"meta.embedded.block.rust": "rust"
|
||||
}
|
||||
}
|
||||
],
|
||||
"problemMatchers": [
|
||||
|
|
93
editors/code/rustdoc-inject.json
Normal file
93
editors/code/rustdoc-inject.json
Normal file
|
@ -0,0 +1,93 @@
|
|||
{
|
||||
"injectionSelector": "L:source.rust -string -comment -meta.embedded.block.rustdoc.md",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#triple-slash"
|
||||
},
|
||||
{
|
||||
"include": "#double-slash-exclamation"
|
||||
},
|
||||
{
|
||||
"include": "#slash-start-exclamation"
|
||||
},
|
||||
{
|
||||
"include": "#slash-double-start"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"triple-slash": {
|
||||
"begin": "(^|\\G)\\s*(///) ?",
|
||||
"captures": {
|
||||
"2": {
|
||||
"name": "comment.line.double-slash.rust"
|
||||
}
|
||||
},
|
||||
"name": "comment.quote_code.triple-slash.rust",
|
||||
"contentName": "meta.embedded.block.rustdoc",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "text.html.markdown.rustdoc"
|
||||
}
|
||||
],
|
||||
"while": "(^|\\G)\\s*(///) ?"
|
||||
},
|
||||
"double-slash-exclamation": {
|
||||
"begin": "(^|\\G)\\s*(//!) ?",
|
||||
"captures": {
|
||||
"2": {
|
||||
"name": "comment.line.double-slash.rust"
|
||||
}
|
||||
},
|
||||
"name": "comment.quote_code.double-slash-exclamation.rust",
|
||||
"contentName": "meta.embedded.block.rustdoc",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "text.html.markdown.rustdoc"
|
||||
}
|
||||
],
|
||||
"while": "(^|\\G)\\s*(//!) ?"
|
||||
},
|
||||
"slash-start-exclamation": {
|
||||
"begin": "(^)(/\\*!) ?$",
|
||||
"captures": {
|
||||
"2": {
|
||||
"name": "comment.block.rust"
|
||||
}
|
||||
},
|
||||
"name": "comment.quote_code.slash-start-exclamation.rust",
|
||||
"contentName": "meta.embedded.block.rustdoc",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "text.html.markdown.rustdoc"
|
||||
}
|
||||
],
|
||||
"end": "( ?)(\\*/)"
|
||||
},
|
||||
"slash-double-start": {
|
||||
"name": "comment.quote_code.slash-double-start-quote-star.rust",
|
||||
"begin": "(?:^)\\s*/\\*\\* ?$",
|
||||
"end": "\\*/",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#quote-star"
|
||||
}
|
||||
]
|
||||
},
|
||||
"quote-star": {
|
||||
"begin": "(^|\\G)\\s*(\\*(?!/)) ?",
|
||||
"captures": {
|
||||
"2": {
|
||||
"name": "comment.punctuation.definition.quote_code.slash-star.MR"
|
||||
}
|
||||
},
|
||||
"contentName": "meta.embedded.block.rustdoc",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "text.html.markdown.rustdoc"
|
||||
}
|
||||
],
|
||||
"while": "(^|\\G)\\s*(\\*(?!/)) ?"
|
||||
}
|
||||
},
|
||||
"scopeName": "comment.markdown-cell-inject.rustdoc"
|
||||
}
|
82
editors/code/rustdoc.json
Normal file
82
editors/code/rustdoc.json
Normal file
|
@ -0,0 +1,82 @@
|
|||
{
|
||||
"name": "rustdoc",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#fenced_code_block"
|
||||
},
|
||||
{
|
||||
"include": "#markdown"
|
||||
}
|
||||
],
|
||||
"scopeName": "text.html.markdown.rustdoc",
|
||||
"repository": {
|
||||
"markdown": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "text.html.markdown"
|
||||
}
|
||||
]
|
||||
},
|
||||
"fenced_code_block": {
|
||||
"patterns": [
|
||||
{
|
||||
"include": "#fenced_code_block_rust"
|
||||
},
|
||||
{
|
||||
"include": "#fenced_code_block_unknown"
|
||||
}
|
||||
]
|
||||
},
|
||||
"fenced_code_block_rust": {
|
||||
"begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?i:(rust|not run|not_run)?((\\s+|:|,|\\{|\\?)[^`~]*)?$)",
|
||||
"name": "markup.fenced_code.block.markdown",
|
||||
"end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$",
|
||||
"beginCaptures": {
|
||||
"3": {
|
||||
"name": "punctuation.definition.markdown"
|
||||
},
|
||||
"4": {
|
||||
"name": "fenced_code.block.language.markdown"
|
||||
},
|
||||
"5": {
|
||||
"name": "fenced_code.block.language.attributes.markdown"
|
||||
}
|
||||
},
|
||||
"endCaptures": {
|
||||
"3": {
|
||||
"name": "punctuation.definition.markdown"
|
||||
}
|
||||
},
|
||||
"patterns": [
|
||||
{
|
||||
"begin": "(^|\\G)(\\s*)(.*)",
|
||||
"while": "(^|\\G)(?!\\s*([`~]{3,})\\s*$)",
|
||||
"contentName": "meta.embedded.block.rust",
|
||||
"patterns": [
|
||||
{
|
||||
"include": "source.rust"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"fenced_code_block_unknown": {
|
||||
"begin": "(^|\\G)(\\s*)(`{3,}|~{3,})\\s*(?=([^`~]+)?$)",
|
||||
"beginCaptures": {
|
||||
"3": {
|
||||
"name": "punctuation.definition.markdown"
|
||||
},
|
||||
"4": {
|
||||
"name": "fenced_code.block.language"
|
||||
}
|
||||
},
|
||||
"end": "(^|\\G)(\\2|\\s{0,3})(\\3)\\s*$",
|
||||
"endCaptures": {
|
||||
"3": {
|
||||
"name": "punctuation.definition.markdown"
|
||||
}
|
||||
},
|
||||
"name": "markup.fenced_code.block.markdown"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,26 @@
|
|||
export interface JsonProject {
|
||||
/// Path to the sysroot directory.
|
||||
///
|
||||
/// The sysroot is where rustc looks for the
|
||||
/// crates that are built-in to rust, such as
|
||||
/// std.
|
||||
///
|
||||
/// https://doc.rust-lang.org/rustc/command-line-arguments.html#--sysroot-override-the-system-root
|
||||
///
|
||||
/// To see the current value of sysroot, you
|
||||
/// can query rustc:
|
||||
///
|
||||
/// ```
|
||||
/// $ rustc --print sysroot
|
||||
/// /Users/yourname/.rustup/toolchains/stable-x86_64-apple-darwin
|
||||
/// ```
|
||||
sysroot?: string;
|
||||
/// Path to the directory with *source code* of
|
||||
/// sysroot crates.
|
||||
///
|
||||
/// By default, this is `lib/rustlib/src/rust/library`
|
||||
/// relative to the sysroot.
|
||||
///
|
||||
/// It should point to the directory where std,
|
||||
/// core, and friends can be found:
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue