Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No completion results while inserting trait method names while inside a proc_macro #18497

Open
kurtbuilds opened this issue Nov 9, 2024 · 1 comment
Labels
C-bug Category: bug

Comments

@kurtbuilds
Copy link

Completion inside a macro appears to not work. I was working on a language server using tower-lsp, which looks like this:

#[tower_lsp::async_trait]
impl LanguageServer for Backend {
    async fn did_change_configuration(&self, _: DidChangeConfigurationParams) {}
    async fn did_open(&self, _: DidOpenTextDocumentParams) {}

    async fn initialize(&self, _: InitializeParams) -> Result<InitializeResult> {
        Ok(InitializeResult {
            capabilities: ServerCapabilities {
                hover_provider: Some(HoverProviderCapability::Simple(true)),
                completion_provider: Some(CompletionOptions::default()),
                ..Default::default()
            },
            ..Default::default()
        })
    }

    async fn initialized(&self, _: InitializedParams) {
        self.client
            .log_message(MessageType::INFO, "server initialized!")
            .await;
    }

    async fn shutdown(&self) -> Result<()> {
        Ok(())
    }

    async fn completion(&self, _: CompletionParams) -> Result<Option<CompletionResponse>> {
        Ok(Some(CompletionResponse::Array(vec![
            CompletionItem::new_simple("Hello".to_string(), "Some detail".to_string()),
            CompletionItem::new_simple("Bye".to_string(), "More detail".to_string()),
        ])))
    }

    async fn hover(&self, _: HoverParams) -> Result<Option<Hover>> {
        Ok(Some(Hover {
            contents: HoverContents::Scalar(MarkedString::String("You're hovering!".to_string())),
            range: None,
        }))
    }
}

Autocompletion for the new methods at the top, did_change_configuration and did_open, did not return any results. Expected behavior would be the traits of the method.

@kurtbuilds kurtbuilds added the C-bug Category: bug label Nov 9, 2024
@kurtbuilds kurtbuilds changed the title Completion of trait method names while inside a proc_macro aeNo completion results while inserting trait method names while inside a proc_macro Nov 9, 2024
@kurtbuilds kurtbuilds changed the title aeNo completion results while inserting trait method names while inside a proc_macro No completion results while inserting trait method names while inside a proc_macro Nov 9, 2024
@ChayimFriedman2
Copy link
Contributor

Completion when typing inside the trait or completion of methods from this trait?

Also, can you post the result of "Expand macro recursively" here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants