-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[relay-lsp] Support go to definition within schema (extension) files #4627
[relay-lsp] Support go to definition within schema (extension) files #4627
Conversation
011cf3c
to
f49c0c9
Compare
@@ -516,8 +523,26 @@ impl<TPerfLogger: PerfLogger + 'static, TSchemaDocumentation: SchemaDocumentatio | |||
js_server.process_js_source(uri, text); | |||
} | |||
|
|||
let source_location = SourceLocationKey::standalone(uri.path()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use FileCategorizer to determine whether the file is a schema (extension) file
// First we check to see if this document has any GraphQL documents. | ||
let embedded_sources = extract_graphql::extract(text); | ||
|
||
let should_init_lsp_resources = | ||
!embedded_sources.is_empty() || uri.as_str().ends_with(".graphql"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use FileCategorizer result here as well
@@ -530,6 +555,13 @@ impl<TPerfLogger: PerfLogger + 'static, TSchemaDocumentation: SchemaDocumentatio | |||
js_server.process_js_source(uri, full_text); | |||
} | |||
|
|||
let source_location = SourceLocationKey::standalone(uri.path()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
Ok(project_name.into()) | ||
} | ||
|
||
fn get_file_contents(path: &Path) -> LSPRuntimeResult<String> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
let file_path = uri | ||
.to_file_path() | ||
.map_err(|_| LSPRuntimeError::ExpectedError)?; | ||
let text = get_file_contents(file_path.as_path())?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually implement a TextSource without reading from disk
Depends on #4626