@@ -18,7 +18,7 @@ impl<'a> CompletionContext<'a> {
1818 pub fn new ( params : & ' a CompletionParams ) -> Self {
1919 let mut tree = Self {
2020 tree : params. tree ,
21- text : params. text ,
21+ text : & params. text ,
2222 schema_cache : params. schema ,
2323 position : usize:: from ( params. position ) ,
2424
@@ -102,7 +102,7 @@ impl<'a> CompletionContext<'a> {
102102
103103#[ cfg( test) ]
104104mod tests {
105- use crate :: context:: CompletionContext ;
105+ use crate :: { context:: CompletionContext , test_helper :: CURSOR_POS } ;
106106
107107 fn get_tree ( input : & str ) -> tree_sitter:: Tree {
108108 let mut parser = tree_sitter:: Parser :: new ( ) ;
@@ -113,8 +113,6 @@ mod tests {
113113 parser. parse ( input, None ) . expect ( "Unable to parse tree" )
114114 }
115115
116- static CURSOR_POS : & str = "XXX" ;
117-
118116 #[ test]
119117 fn identifies_clauses ( ) {
120118 let test_cases = vec ! [
@@ -151,7 +149,7 @@ mod tests {
151149 let tree = get_tree ( text. as_str ( ) ) ;
152150 let params = crate :: CompletionParams {
153151 position : ( position as u32 ) . into ( ) ,
154- text : text. as_str ( ) ,
152+ text : text,
155153 tree : Some ( & tree) ,
156154 schema : & pg_schema_cache:: SchemaCache :: new ( ) ,
157155 } ;
@@ -184,7 +182,7 @@ mod tests {
184182 let tree = get_tree ( text. as_str ( ) ) ;
185183 let params = crate :: CompletionParams {
186184 position : ( position as u32 ) . into ( ) ,
187- text : text. as_str ( ) ,
185+ text : text,
188186 tree : Some ( & tree) ,
189187 schema : & pg_schema_cache:: SchemaCache :: new ( ) ,
190188 } ;
@@ -219,7 +217,7 @@ mod tests {
219217 let tree = get_tree ( text. as_str ( ) ) ;
220218 let params = crate :: CompletionParams {
221219 position : ( position as u32 ) . into ( ) ,
222- text : text. as_str ( ) ,
220+ text : text,
223221 tree : Some ( & tree) ,
224222 schema : & pg_schema_cache:: SchemaCache :: new ( ) ,
225223 } ;
0 commit comments