alephium / ralph-lsp

Ralph language server
7 stars 1 forks source link

Inconsistent default settings in `ralph.json` and `alephium.config.ts` #291

Open simerplaha opened 2 months ago

simerplaha commented 2 months ago

Default Settings

The sourceDir configuration in alephium.config.ts documents that it defaults to <project_root>/contracts. However, in LSP, the issue #273 changed this behaviour to use the project_root as the default source directory to avoid the error "Directory 'contracts' does not exist" for new projects. This behaviour is inconsistent with the documentation and could be confusing. contractPath in ralph.json originally defaulted to contracts which was consistent with the documentation.

This also applies to solution implemented for issue #247, for the artifactPath configuration. The documentation says that alephium.config.ts defaults artifactDir to <project_root>/artifacts. artifactPath in ralph.json also originally defaulted to artifacts which was consistent with this documentation.

Alternative solution to avoid the "'directory' does not exist" errors is to generate the default source directories contracts and artifacts, maybe drop artifactPath for now and revert when #84 is being implemented. This also means that a new project with a single .ral file will not compile unless it's placed in contracts directory.

Naming Convention

There are also naming convention mismatches between ralph.json and alephium.config.ts. For example, alephium.config.ts uses the name sourceDir whereas ralph.json uses the name contractPath. The current naming convention used in ralph.json follows the node class Config.scala.