fix: validate template paths and document the LSP server - #1716
Conversation
- onDefinition now bounds the client-supplied *.template.json path to the project's cdk.out (realpath on both sides) before reading, matching the file-read discipline used elsewhere in the package. Prevents reading arbitrary files via a crafted textDocument/definition request. - Replace the placeholder README with real content: purpose, how to launch (cdk lsp / startLspServer), features, a security note that auto-synth and 'Synth now' run the cdk.json app command with your credentials on save (enable only on trusted projects), and editor-integration notes. - Remove the unused express / @types/express dependencies; the web interface is not part of this branch.
| import { startLspServer } from '@aws-cdk/cdk-explorer'; | ||
| startLspServer(); | ||
|
|
||
| ## Features |
There was a problem hiding this comment.
This section seems a bit weird to me, why are we advertising codelens as the primary feature here, can you maybe reorganize this so we have a list of the features? - mostly so we are not projecting one feature as being more important than the others
There was a problem hiding this comment.
sounds good, will just include the synth triggering and the resource codelenses both in a flat list.
|
|
||
| ## Status | ||
|
|
||
| This release ships the LSP server only. The web interface is not part of this |
There was a problem hiding this comment.
We don't need to mention that the web interface is not here yet, we don't need to mention it in the README, once it arrives, we can add it
There was a problem hiding this comment.
okay, will do. can just add that as a note in the ticket then, i know they asked about whether the web explorer was part of this yet
…s note Address README review: present features as one equal list rather than leading with code lenses, and remove the LSP-only status note.
| generated template. | ||
| - Go to definition: from a position in a synthesized `*.template.json` back to the | ||
| construct source that produced it. | ||
| - Diagnostics: policy validation report findings appear as squiggles in source. |
There was a problem hiding this comment.
Can you clarify a bit more how this works, since we don't just show the squiggles, I think there is also a hover that explains how to fix it. Also don't the squiggles appear on the same line as the construct, not the actual source of the problem (since we don't have that info through the validator)
There was a problem hiding this comment.
yep, I'll expand this. I'll make both explicit, lmk if the new wording looks good
There was a problem hiding this comment.
Somewhere in here I think we want to mention that we pull this information from a user's cdk.out directory
There was a problem hiding this comment.
adding to the intro paragraph
Expand the diagnostics feature description: the rule description and any suggested fix appear in the diagnostic message (on hover and in the problems list), and squiggles anchor on the construct-creation line since the validation report identifies a violating construct, not a source line. Also name the cdk.out directory as the source the server reads.
Fixes #
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license