Regenrate docs and package.json

This commit is contained in:
Lukas Wirth 2022-01-05 19:35:48 +01:00
parent aecf26d09b
commit dd4b53402d
5 changed files with 26 additions and 6 deletions

View file

@ -55,8 +55,6 @@ pub trait InternDatabase: SourceDatabase {
pub trait DefDatabase: InternDatabase + AstDatabase + Upcast<dyn AstDatabase> {
#[salsa::input]
fn enable_proc_attr_macros(&self) -> bool;
#[salsa::input]
fn enablse_proc_attr_macros(&self) -> bool;
#[salsa::invoke(ItemTree::file_item_tree_query)]
fn file_item_tree(&self, file_id: HirFileId) -> Arc<ItemTree>;

View file

@ -301,6 +301,8 @@ config_data! {
/// Internal config, path to proc-macro server executable (typically,
/// this is rust-analyzer itself, but we override this in tests).
procMacro_server: Option<PathBuf> = "null",
/// Replaces the proc-macro expanders for the named proc-macros in the named crates with
/// an identity expander that outputs the input again.
procMacro_dummies: FxHashMap<Box<str>, Box<[Box<str>]>> = "{}",
/// Command to be executed instead of 'cargo' for runnables.
@ -1167,7 +1169,13 @@ fn get_field<T: DeserializeOwned>(
.find_map(move |field| {
let mut pointer = field.replace('_', "/");
pointer.insert(0, '/');
json.pointer_mut(&pointer).and_then(|it| serde_json::from_value(it.take()).ok())
json.pointer_mut(&pointer).and_then(|it| match serde_json::from_value(it.take()) {
Ok(it) => Some(it),
Err(e) => {
tracing::warn!("Failed to deserialize config field at {}: {:?}", pointer, e);
None
}
})
})
.unwrap_or(default)
}
@ -1228,6 +1236,9 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
"items": { "type": "string" },
"uniqueItems": true,
},
"FxHashMap<Box<str>, Box<[Box<str>]>>" => set! {
"type": "object",
},
"FxHashMap<String, SnippetDef>" => set! {
"type": "object",
},

View file

@ -291,9 +291,6 @@ impl GlobalState {
}
},
};
self.analysis_host
.raw_database_mut()
.set_enable_proc_attr_macros(self.config.expand_proc_attr_macros());
}
let watch = match files_config.watcher {
@ -514,6 +511,8 @@ impl SourceRootConfig {
}
}
/// Load the proc-macros for the given lib path, replacing all expanders whose names are in `dummy_replace`
/// with an identity dummy expander.
pub(crate) fn load_proc_macro(
client: Option<&ProcMacroServer>,
path: &AbsPath,
@ -586,6 +585,7 @@ pub(crate) fn load_proc_macro(
}
}
/// Dummy identity expander, used for proc-macros that are deliberately ignored by the user.
#[derive(Debug)]
struct DummyExpander;

View file

@ -455,6 +455,12 @@ Enable support for procedural macros, implies `#rust-analyzer.cargo.runBuildScri
Internal config, path to proc-macro server executable (typically,
this is rust-analyzer itself, but we override this in tests).
--
[[rust-analyzer.procMacro.dummies]]rust-analyzer.procMacro.dummies (default: `{}`)::
+
--
Replaces the proc-macro expanders for the named proc-macros in the named crates with
an identity expander that outputs the input again.
--
[[rust-analyzer.runnables.overrideCargo]]rust-analyzer.runnables.overrideCargo (default: `null`)::
+
--

View file

@ -880,6 +880,11 @@
"string"
]
},
"rust-analyzer.procMacro.dummies": {
"markdownDescription": "Replaces the proc-macro expanders for the named proc-macros in the named crates with\nan identity expander that outputs the input again.",
"default": {},
"type": "object"
},
"rust-analyzer.runnables.overrideCargo": {
"markdownDescription": "Command to be executed instead of 'cargo' for runnables.",
"default": null,