Skip to content
This repository has been archived by the owner on Apr 28, 2024. It is now read-only.

feat(lsp): initial stub for server and client #9

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "${defaultBuildTask}"
"preLaunchTask": "npm: compile"
}
]
}
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
"typescript.tsc.autoDetect": "off",
"cSpell.words": [
"frontmatter",
"Stencila"
],
"yaml.schemas": {
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# stencila README


## Developing

### Organization

- `fixtures/nodes`: contains examples of Stencila nodes in JSON

- `templates`: contains Jinja2 Markdown templates for rendering [`Hover`](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_hover) for nodes. These are prototypes that will be moved to the `rust/lsp` crate (in the main `stencila/stencila` repo) later.


This is the README for your extension "stencila". After writing up a brief description, we recommend including the following sections.

## Features
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions fixtures/nodes/code-block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"type": "CodeBlock",
"code": "print(\"Hello world!\")",
"programmingLanguage": "r"
}

19 changes: 19 additions & 0 deletions fixtures/nodes/code-chunk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"type": "CodeChunk",
"code": "print(\"Hello world!\")",
"programmingLanguage": "python",
"outputs": ["Hello world!"],
"executionCount": 1,
"executionRequired": "No",
"executionStatus": "Succeeded",
"executionEnded": {
"type": "Timestamp",
"value": 1710299943307,
"timeUnit": "Millisecond"
},
"executionDuration": {
"type": "Duration",
"value": 1605,
"timeUnit": "Millisecond"
}
}
27 changes: 27 additions & 0 deletions fixtures/nodes/code-chunk.with-exception.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"type": "CodeChunk",
"code": "if # This is a syntax error",
"programmingLanguage": "python",
"executionCount": 1,
"executionRequired": "ExecutionFailed",
"executionStatus": "Exceptions",
"executionEnded": {
"type": "Timestamp",
"value": 1710456671989,
"timeUnit": "Millisecond"
},
"executionDuration": {
"type": "Duration",
"value": 3,
"timeUnit": "Millisecond"
},
"executionMessages": [
{
"type": "ExecutionMessage",
"level": "Exception",
"message": "invalid syntax (<code>, line 1)",
"errorType": "SyntaxError",
"stackTrace": "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"<code>\", line 1\n if # This is a syntax error\n ^^\nSyntaxError: invalid syntax"
}
]
}
134 changes: 134 additions & 0 deletions fixtures/nodes/for-block.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{
"type": "ForBlock",
"code": "items",
"variable": "item",
"content": [
{
"type": "Paragraph",
"content": [
{
"type": "Text",
"value": "This is item "
},
{
"type": "CodeExpression",
"code": "item"
}
]
}
],
"iterations": [
{
"type": "Section",
"content": [
{
"type": "Paragraph",
"content": [
{
"type": "Text",
"value": "This is item "
},
{
"type": "CodeExpression",
"code": "item",
"output": 1,
"executionCount": 1,
"executionRequired": "No",
"executionStatus": "Succeeded",
"executionEnded": {
"type": "Timestamp",
"value": 1710300042681,
"timeUnit": "Millisecond"
},
"executionDuration": {
"type": "Duration",
"value": 44,
"timeUnit": "Millisecond"
}
}
]
}
],
"sectionType": "Iteration"
},
{
"type": "Section",
"content": [
{
"type": "Paragraph",
"content": [
{
"type": "Text",
"value": "This is item "
},
{
"type": "CodeExpression",
"code": "item",
"output": 2,
"executionCount": 1,
"executionRequired": "No",
"executionStatus": "Succeeded",
"executionEnded": {
"type": "Timestamp",
"value": 1710300042696,
"timeUnit": "Millisecond"
},
"executionDuration": {
"type": "Duration",
"value": 2,
"timeUnit": "Millisecond"
}
}
]
}
],
"sectionType": "Iteration"
},
{
"type": "Section",
"content": [
{
"type": "Paragraph",
"content": [
{
"type": "Text",
"value": "This is item "
},
{
"type": "CodeExpression",
"code": "item",
"output": 3,
"executionCount": 1,
"executionRequired": "No",
"executionStatus": "Succeeded",
"executionEnded": {
"type": "Timestamp",
"value": 1710300042700,
"timeUnit": "Millisecond"
},
"executionDuration": {
"type": "Duration",
"value": 2,
"timeUnit": "Millisecond"
}
}
]
}
],
"sectionType": "Iteration"
}
],
"executionCount": 1,
"executionRequired": "No",
"executionStatus": "Succeeded",
"executionEnded": {
"type": "Timestamp",
"value": 1710300042702,
"timeUnit": "Millisecond"
},
"executionDuration": {
"type": "Duration",
"value": 77,
"timeUnit": "Millisecond"
}
}
9 changes: 9 additions & 0 deletions fixtures/nodes/paragraph.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "Paragraph",
"content": [
{
"type": "Text",
"value": "The ocean, a vast expanse of mystery and wonder..."
}
]
}
41 changes: 41 additions & 0 deletions fixtures/nodes/paragraph.with-authors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"type": "Paragraph",
"content": [
{
"type": "Text",
"value": "The ocean, a vast expanse of mystery and wonder, is home to some of the most fascinating creatures on Earth. Among these, the fish known for their uncanny speed stand out, showcasing natures marvel in the aquatic realm. This article dives into the realm of these speedy swimmers, discussing various aspects from the mechanisms behind their remarkable speed to a comprehensive overview of the top contenders."
}
],
"authors": [
{
"type": "AuthorRole",
"author": {
"type": "SoftwareApplication",
"id": "openai/gpt-4-0125-preview",
"name": "GPT",
"version": "4-0125-preview"
},
"roleName": "Generator",
"lastModified": {
"type": "Timestamp",
"value": 1710989144957,
"timeUnit": "Millisecond"
}
},
{
"type": "AuthorRole",
"author": {
"type": "SoftwareApplication",
"id": "stencila/insert-blocks",
"name": "Insert Blocks",
"version": "0.1.0"
},
"roleName": "Prompter",
"lastModified": {
"type": "Timestamp",
"value": 1710989144957,
"timeUnit": "Millisecond"
}
}
]
}
5 changes: 5 additions & 0 deletions icons/nodes/code-block.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icons/nodes/code-chunk.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions icons/nodes/for-block.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading