Skip to content

Commit

Permalink
Merge pull request #70 from alephium/rename_build_file
Browse files Browse the repository at this point in the history
Rename build file to `ralph.json`
  • Loading branch information
simerplaha authored Dec 4, 2023
2 parents d2f7948 + 1a650a1 commit b085692
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 17 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ Look in `target` folder: `.../ralph-lsp/lsp-server/target/scala-2.13/ralph-lsp.j

# Configuration

Create a mandatory config file named `build.ralph` in your project's root directory. You can use the following sample as reference:
Create a mandatory config file named `ralph.json` in your project's root directory. You can use the following sample as reference:

`build.ralph`
`ralph.json`

```
```json
{
"compilerOptions": {
"ignoreUnusedConstantsWarnings": false,
Expand All @@ -28,8 +28,8 @@ Create a mandatory config file named `build.ralph` in your project's root direct
"ignoreUpdateFieldsCheckWarnings": false,
"ignoreCheckExternalCallerWarnings": false
},
"contractPath": "./contracts",
"artifactPath": "./artifacts"
"contractPath": "contracts",
"artifactPath": "artifacts"
}
```

Expand All @@ -55,14 +55,14 @@ Install the [ralph.vim](https://github.com/tdroxler/ralph.vim) plugin with your

Add the following to your lua configuration

```
```lua
local function ralph_init()

local capabilities = vim.lsp.protocol.make_client_capabilities()

capabilities.workspace.didChangeWatchedFiles.dynamicRegistration = true

local root_dir = vim.fs.dirname(vim.fs.find({'build.ralph', 'contracts', 'artifacts'}, { upward = true })[1])
local root_dir = vim.fs.dirname(vim.fs.find({'ralph.json', 'contracts', 'artifacts'}, { upward = true })[1])
if root_dir == nil then root_dir = vim.fn.getcwd() end

vim.lsp.start({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ object SourceIndex {
* Sending negative index to the client would be incorrect.
* This set the index to be an empty range.
*
* This is a temporary solution until an AST is available for `build.ralph`.
* This is a temporary solution until an AST is available for `ralph.json`.
*
* @see Issue <a href="https://github.com/alephium/ralph-lsp/issues/17">#17</a>.
*/
Expand Down
5 changes: 2 additions & 3 deletions plugin-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@
},
"activationEvents": [
"onLanguage:ralph",
"workspaceContains:*.ral",
"workspaceContains:*/*.ral",
"workspaceContains:*.ralph"
"workspaceContains:**/*.ral",
"workspaceContains:ralph.json"
],
"main": "./out/extension",
"scripts": {
Expand Down
5 changes: 4 additions & 1 deletion plugin-vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ export function activate(context: ExtensionContext) {
};

const clientOptions: LanguageClientOptions = {
documentSelector: [{pattern: '**/*.{ral,ralph}'}]
documentSelector: [
{pattern: '**/*.ral'},
{language: 'json', pattern: '**/ralph.json'},
]
};

// Create the client and store it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import scala.collection.immutable.ArraySeq

object Build {

val BUILD_FILE_EXTENSION = "ralph"
val BUILD_FILE_EXTENSION = "json"

/** Build file of a workspace */
val BUILD_FILE_NAME = s"build.$BUILD_FILE_EXTENSION"
val BUILD_FILE_NAME = s"ralph.$BUILD_FILE_EXTENSION"

def toBuildPath(workspacePath: Path): Path =
workspacePath.resolve(BUILD_FILE_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import java.net.URI
import scala.collection.immutable.ArraySeq
import scala.collection.mutable.ListBuffer

/** Implements functions for validating `build.ralph` */
/** Implements functions for validating `ralph.json` */
object BuildValidator {

/** Validate and promotes a parsed build-file to compiled */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ object Dependency {
)

case Right(dependencyStd) =>
// Compile std. A dependency is just a regular workspace with a `build.ralph` file.
// Compile std. A dependency is just a regular workspace with a `ralph.json` file.
val dependencyStdCompiled =
Workspace.parseAndCompile(dependencyStd)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ object DependencyDownloader extends LazyLogging {
}

/**
* Currently dependencies do not contain a `build.ralph` file.
* Currently dependencies do not contain a `ralph.json` file.
* This function create a default one for the `std` package.
*/
private def defaultBuildForStd(): BuildState.BuildCompiled = {
Expand Down

0 comments on commit b085692

Please sign in to comment.