Skip to content

Conversation

DominusKelvin
Copy link
Collaborator

Resolves #24

This pull request introduces a new validation function, validateViewExist, to ensure that views referenced in routes.js and controller actions exist in the /views directory. The changes are integrated into the validateDocument pipeline and include the implementation of helper functions for extracting view references. Below are the key changes grouped by theme:

Integration of validateViewExist into the validation pipeline:

  • Added validateViewExist to the list of imported validators in packages/language-server/validators/validate-document.js.
  • Modified the validateDocument function to invoke validateViewExist and include its diagnostics in the overall diagnostics array.

Implementation of validateViewExist:

  • Created a new file, packages/language-server/validators/validate-view-exist.js, which defines the validateViewExist function. This function checks for missing views in routes.js and controller actions, generating diagnostics for unresolved view references.
  • Added helper functions extractViewReferences and extractViewTemplatePathReferences to parse view references from routes.js and controller actions, respectively. These functions use regular expressions to locate and extract view paths along with their corresponding ranges.

@DominusKelvin DominusKelvin merged commit 1456a5f into develop May 28, 2025
4 checks passed
@DominusKelvin DominusKelvin deleted the feat/add-validation-for-in-a-view-exist branch May 28, 2025 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Implement diagnostic for the existence of a view
1 participant