microsoft / microsoft/vscode-powerquery-sdk

Empty or Comment Only File Dies with Unexpected Error

Open
#314 0 comments 0 reactions 1 assignee View on GitHub

@mattmasson is already working on this.

Since Mar 19, 2024.

sdk tools
Dominant language
TypeScript
Stars
92
Forks
23
PR merge metrics
No merged PRs in 30d

Description

Preflight Checklist
Power Query SDK

0.3.1

Regression From

No response

Platform

All

Architecture

x64

OS Version

No response

VSCode version

No response

PQSdkTool Path

No response

Bug Description

If a query test file is evaluated that is either blank or only contains a comment, an unexpected error is output.

The error indicates that a "token literal" is expected (even though non-literal values are also allowed) and indicates that the error occurs on line 3, even though the file does not contain 3 lines.

Steps to Reproduce
  1. Create a new PQ SDK project.
  2. Either empty the '.query.pq' file, or set it to contain only a single-line comment (e.g. //hi).
  3. Evaluate the .query.pq file.
Actual Experience

The following error is returned:

Token Literal expected. Start position: (3, 1). End position (3, 2).
Expected Experience

At minimum, correct line numbering (e.g. reporting the error as occurring on line 1, not the non-existent line 3).

Ideally, a message saying effectively that some code is expected in the file (maybe that the file must contain either an expression or a section document).

Additional Context

Related: https://github.com/microsoft/vscode-powerquery-sdk/issues/244

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.