mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
5089: Disable auto-complete on comments r=matklad a=BGluth Resolves #4907 by disabling any auto-completion on comments. As flodiebold [pointed out](https://github.com/rust-analyzer/rust-analyzer/issues/4907#issuecomment-648439979), in the future we may want to support some form of auto-completion within doc comments, but for now it was suggested to just disable auto-completion on them entirely. The implementation involves adding a new field `is_comment` to `CompletionContext` and checking if the immediate token we auto-completed on is a comment. I couldn't see a case where we need to check any of the ancestors, but let me know if this is not sufficient. I also wasn't sure if it was necessary to add a new field to this struct, but I decided it's probably the best option if we want to potentially do auto-completion on doc comments in the future. Finally, the three tests I added should I think ideally not filter results by `CompletionKind::Keyword`, but if I want to get unfiltered results, I need access to a non-public function [get_all_completion_items](9a4d02faf9/crates/ra_ide/src/completion/test_utils.rs (L32-L39)
) which I don't know if I should make public just for this. 5161: SSR: Add initial support for placeholder constraints r=matklad a=davidlattimore 5184: Always install required nightly extension if current one is not nightly r=matklad a=Veetaha This is weird, but having switched back to stable by uninstalling the extension appears that vscode doesn't destroy the `PersistentState` and thus changing to `nightly` channel doesn't work because the last check for nightly extension was less than 1 hour ago. The simple solution is to skip this check if we know that the current extension version is not nightly. 5185: Force showing extension activation error pop-up notification r=matklad a=Veetaha Fixes https://github.com/rust-analyzer/rust-analyzer/issues/5091 5186: fix: correct pd/ppd/tfn/tmod completion doc r=matklad a=fannheywarda33eefa3b2/crates/ra_ide/src/completion/complete_snippet.rs (L23-L24)
Co-authored-by: BGluth <gluthb@gmail.com> Co-authored-by: David Lattimore <dml@google.com> Co-authored-by: Veetaha <veetaha2@gmail.com> Co-authored-by: Heyward Fann <fannheyward@gmail.com>
This commit is contained in:
commit
57ed622ec4
10 changed files with 242 additions and 26 deletions
|
@ -19,6 +19,16 @@ let ctx: Ctx | undefined;
|
|||
const RUST_PROJECT_CONTEXT_NAME = "inRustProject";
|
||||
|
||||
export async function activate(context: vscode.ExtensionContext) {
|
||||
// For some reason vscode not always shows pop-up error notifications
|
||||
// when an extension fails to activate, so we do it explicitly by ourselves.
|
||||
// FIXME: remove this bit of code once vscode fixes this issue: https://github.com/microsoft/vscode/issues/101242
|
||||
await tryActivate(context).catch(err => {
|
||||
void vscode.window.showErrorMessage(`Cannot activate rust-analyzer: ${err.message}`);
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
|
||||
async function tryActivate(context: vscode.ExtensionContext) {
|
||||
// Register a "dumb" onEnter command for the case where server fails to
|
||||
// start.
|
||||
//
|
||||
|
@ -58,9 +68,7 @@ export async function activate(context: vscode.ExtensionContext) {
|
|||
|
||||
const workspaceFolder = vscode.workspace.workspaceFolders?.[0];
|
||||
if (workspaceFolder === undefined) {
|
||||
const err = "Cannot activate rust-analyzer when no folder is opened";
|
||||
void vscode.window.showErrorMessage(err);
|
||||
throw new Error(err);
|
||||
throw new Error("no folder is opened");
|
||||
}
|
||||
|
||||
// Note: we try to start the server before we activate type hints so that it
|
||||
|
@ -152,13 +160,17 @@ async function bootstrapExtension(config: Config, state: PersistentState): Promi
|
|||
return;
|
||||
};
|
||||
|
||||
const lastCheck = state.lastCheck;
|
||||
const now = Date.now();
|
||||
if (config.package.releaseTag === NIGHTLY_TAG) {
|
||||
// Check if we should poll github api for the new nightly version
|
||||
// if we haven't done it during the past hour
|
||||
const lastCheck = state.lastCheck;
|
||||
|
||||
const anHour = 60 * 60 * 1000;
|
||||
const shouldDownloadNightly = state.releaseId === undefined || (now - (lastCheck ?? 0)) > anHour;
|
||||
const anHour = 60 * 60 * 1000;
|
||||
const shouldCheckForNewNightly = state.releaseId === undefined || (now - (lastCheck ?? 0)) > anHour;
|
||||
|
||||
if (!shouldDownloadNightly) return;
|
||||
if (!shouldCheckForNewNightly) return;
|
||||
}
|
||||
|
||||
const release = await fetchRelease("nightly").catch((e) => {
|
||||
log.error(e);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue