Skip to content
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

Implement syntax checking features #307

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open

Conversation

worksofliam
Copy link
Contributor

@worksofliam worksofliam commented Dec 17, 2024

Introduce a problem provider that highlights SQL syntax issues and allows for configurable syntax check intervals. This feature will only syntax check as you are typing. If you're working in a document made up of multiple statements, it will only check the statement you're currently working on while you type. You can use the newly added button to check an entire document.

How to test while editing:

  1. Connect to IBM i with Code for IBM i
  2. Open an SQL document (new or existing)
  3. Start typing. There is wait period before the syntax is checked (configurable), but the default is 1.5 seconds.

Test the Check Syntax button:

  1. Connect to IBM i with Code for IBM i
  2. Open an SQL document (new or existing)
  3. Press the Check Syntax button, which appears next to the Run button in the editor bar in the top right.
image

@worksofliam worksofliam changed the title Implement problem provider and syntax checking features Implement syntax checking features Dec 17, 2024
Copy link

github-actions bot commented Dec 17, 2024

👋 A new build is available for this PR based on c616bff.

@p-behr
Copy link

p-behr commented Dec 18, 2024

It sure appears to provide the same syntax check as running the SQL in ACS Run SQL Scripts :-)

@chrjorgensen chrjorgensen self-requested a review December 18, 2024 16:46
Copy link
Contributor

@chrjorgensen chrjorgensen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@worksofliam Looking good and working fine with most samples. 👍

I found one issue:

  • connect to IBM i (7.5 in my test)
  • open a new SQL document
  • enter the following source:
update qtemp.temp_rcpout
   set COL1 = '123'
     , COL2 = replace( COL2, 'a', 'A' )
     , COL3 = replace( COL3, 'b', 'B' )
     , COL4 = 'L'
     , COL5 = '/dir1/'
     , COL6 = 0
  • press the button to syntax check

I then get this:

billede

@worksofliam
Copy link
Contributor Author

@chrjorgensen Have another look. I added some additional logic to handle when the message ID is not returned, which is why you were seeing the blank message. It actually looks like this could be a bug in the system API, and IMO shouldn't be impactful to this PR.

I also made it so 01 SQL states are warnings and not errors.

@worksofliam
Copy link
Contributor Author

@chrjorgensen I added a new VS Code configuration option to determine if warnings should be shown. It is false by default.

@worksofliam worksofliam linked an issue Dec 19, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Offset to error into the string of SQL when creating procedures and function Syntax checker
3 participants