mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-28 02:29:44 +00:00
Update rust-analyzer for new proc_macro span api.
This commit is contained in:
parent
c447e5792c
commit
44885be61f
2 changed files with 13 additions and 38 deletions
|
|
@ -11,7 +11,7 @@ use std::{
|
||||||
|
|
||||||
use intern::Symbol;
|
use intern::Symbol;
|
||||||
use proc_macro::bridge::{self, server};
|
use proc_macro::bridge::{self, server};
|
||||||
use span::{FileId, Span, FIXUP_ERASED_FILE_AST_ID_MARKER};
|
use span::{Span, FIXUP_ERASED_FILE_AST_ID_MARKER};
|
||||||
use tt::{TextRange, TextSize};
|
use tt::{TextRange, TextSize};
|
||||||
|
|
||||||
use crate::server_impl::{literal_kind_to_internal, token_stream::TokenStreamBuilder, TopSubtree};
|
use crate::server_impl::{literal_kind_to_internal, token_stream::TokenStreamBuilder, TopSubtree};
|
||||||
|
|
@ -27,10 +27,6 @@ mod tt {
|
||||||
|
|
||||||
type TokenStream = crate::server_impl::TokenStream<Span>;
|
type TokenStream = crate::server_impl::TokenStream<Span>;
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
|
|
||||||
pub struct SourceFile {
|
|
||||||
file_id: FileId,
|
|
||||||
}
|
|
||||||
pub struct FreeFunctions;
|
pub struct FreeFunctions;
|
||||||
|
|
||||||
pub struct RaSpanServer {
|
pub struct RaSpanServer {
|
||||||
|
|
@ -46,7 +42,6 @@ pub struct RaSpanServer {
|
||||||
impl server::Types for RaSpanServer {
|
impl server::Types for RaSpanServer {
|
||||||
type FreeFunctions = FreeFunctions;
|
type FreeFunctions = FreeFunctions;
|
||||||
type TokenStream = TokenStream;
|
type TokenStream = TokenStream;
|
||||||
type SourceFile = SourceFile;
|
|
||||||
type Span = Span;
|
type Span = Span;
|
||||||
type Symbol = Symbol;
|
type Symbol = Symbol;
|
||||||
}
|
}
|
||||||
|
|
@ -245,25 +240,17 @@ impl server::TokenStream for RaSpanServer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl server::SourceFile for RaSpanServer {
|
|
||||||
fn eq(&mut self, file1: &Self::SourceFile, file2: &Self::SourceFile) -> bool {
|
|
||||||
file1 == file2
|
|
||||||
}
|
|
||||||
fn path(&mut self, _file: &Self::SourceFile) -> String {
|
|
||||||
// FIXME
|
|
||||||
String::new()
|
|
||||||
}
|
|
||||||
fn is_real(&mut self, _file: &Self::SourceFile) -> bool {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl server::Span for RaSpanServer {
|
impl server::Span for RaSpanServer {
|
||||||
fn debug(&mut self, span: Self::Span) -> String {
|
fn debug(&mut self, span: Self::Span) -> String {
|
||||||
format!("{:?}", span)
|
format!("{:?}", span)
|
||||||
}
|
}
|
||||||
fn source_file(&mut self, span: Self::Span) -> Self::SourceFile {
|
fn file(&mut self, _: Self::Span) -> String {
|
||||||
SourceFile { file_id: span.anchor.file_id.file_id() }
|
// FIXME
|
||||||
|
String::new()
|
||||||
|
}
|
||||||
|
fn local_file(&mut self, _: Self::Span) -> Option<String> {
|
||||||
|
// FIXME
|
||||||
|
None
|
||||||
}
|
}
|
||||||
fn save_span(&mut self, _span: Self::Span) -> usize {
|
fn save_span(&mut self, _span: Self::Span) -> usize {
|
||||||
// FIXME, quote is incompatible with third-party tools
|
// FIXME, quote is incompatible with third-party tools
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,6 @@ type Literal = tt::Literal;
|
||||||
type Span = tt::TokenId;
|
type Span = tt::TokenId;
|
||||||
type TokenStream = crate::server_impl::TokenStream<Span>;
|
type TokenStream = crate::server_impl::TokenStream<Span>;
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub struct SourceFile;
|
|
||||||
pub struct FreeFunctions;
|
pub struct FreeFunctions;
|
||||||
|
|
||||||
pub struct TokenIdServer {
|
pub struct TokenIdServer {
|
||||||
|
|
@ -37,7 +35,6 @@ pub struct TokenIdServer {
|
||||||
impl server::Types for TokenIdServer {
|
impl server::Types for TokenIdServer {
|
||||||
type FreeFunctions = FreeFunctions;
|
type FreeFunctions = FreeFunctions;
|
||||||
type TokenStream = TokenStream;
|
type TokenStream = TokenStream;
|
||||||
type SourceFile = SourceFile;
|
|
||||||
type Span = Span;
|
type Span = Span;
|
||||||
type Symbol = Symbol;
|
type Symbol = Symbol;
|
||||||
}
|
}
|
||||||
|
|
@ -223,24 +220,15 @@ impl server::TokenStream for TokenIdServer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl server::SourceFile for TokenIdServer {
|
|
||||||
fn eq(&mut self, _file1: &Self::SourceFile, _file2: &Self::SourceFile) -> bool {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
fn path(&mut self, _file: &Self::SourceFile) -> String {
|
|
||||||
String::new()
|
|
||||||
}
|
|
||||||
fn is_real(&mut self, _file: &Self::SourceFile) -> bool {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl server::Span for TokenIdServer {
|
impl server::Span for TokenIdServer {
|
||||||
fn debug(&mut self, span: Self::Span) -> String {
|
fn debug(&mut self, span: Self::Span) -> String {
|
||||||
format!("{:?}", span.0)
|
format!("{:?}", span.0)
|
||||||
}
|
}
|
||||||
fn source_file(&mut self, _span: Self::Span) -> Self::SourceFile {
|
fn file(&mut self, _span: Self::Span) -> String {
|
||||||
SourceFile {}
|
String::new()
|
||||||
|
}
|
||||||
|
fn local_file(&mut self, _span: Self::Span) -> Option<String> {
|
||||||
|
None
|
||||||
}
|
}
|
||||||
fn save_span(&mut self, _span: Self::Span) -> usize {
|
fn save_span(&mut self, _span: Self::Span) -> usize {
|
||||||
0
|
0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue