dataform-co / dataform

Dataform is a framework for managing SQL based data operations in BigQuery
https://cloud.google.com/dataform/docs
Apache License 2.0
811 stars 152 forks source link

VSCode ref jump feature shows error under the project without operations in project or schema is specified in the ref #1768

Closed moker-spaghetti closed 1 week ago

moker-spaghetti commented 3 weeks ago

VSCode ref jump featre fails with the situations below.

a) When project lacks operations

[Error - 12:43:20 PM] Request textDocument/definition failed.
  Message: Request textDocument/definition failed with message: Cannot read properties of undefined (reading 'target')
  Code: -32603 

Without operations, graph.operations would be undefined in gatherAllActions() and accessing action.target.name in retrieveLinkedFileName() fails.

https://github.com/dataform-co/dataform/blob/9698b76c05f661a5a9e50ea90d7aa1ec11d98643/vscode/server.ts#L127

https://github.com/dataform-co/dataform/blob/9698b76c05f661a5a9e50ea90d7aa1ec11d98643/vscode/server.ts#L132

b) When schema / project is specified in ref()

[Error - 1:09:02 PM] Request textDocument/definition failed.
  Message: Request textDocument/definition failed with message: Cannot read properties of undefined (reading 'fileName')
  Code: -32603 

Current code does not work when schema / project is specified in ref().

https://github.com/dataform-co/dataform/blob/9698b76c05f661a5a9e50ea90d7aa1ec11d98643/vscode/server.ts#L144