Skip to content

Commit

Permalink
Refactor tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
sgwilym committed Jul 31, 2021
1 parent 9c1cc9e commit f646b52
Show file tree
Hide file tree
Showing 14 changed files with 299 additions and 151 deletions.
17 changes: 8 additions & 9 deletions .nova/Configuration.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"apexskier.typescript.config.userPreferences.disableSuggestions" : false,
"co.gwil.deno.config.enableLinting" : "true",
"co.gwil.deno.config.enableLsp" : "true",
"co.gwil.deno.config.formatOnSave" : "true",
"co.gwil.deno.config.tsconfig" : "dom.tsconfig.json",
"co.gwil.deno.enable" : true,
"deno.enable" : true,
"workspace.art_style" : 0,
"workspace.name" : "nova-deno"
"apexskier.typescript.config.userPreferences.disableSuggestions": false,
"co.gwil.deno.config.enableLinting": "true",
"co.gwil.deno.config.enableLsp": "true",
"co.gwil.deno.config.formatOnSave": "true",
"co.gwil.deno.enable": true,
"deno.enable": true,
"workspace.art_style": 0,
"workspace.name": "nova-deno"
}
12 changes: 6 additions & 6 deletions .nova/Tasks/Bundle.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"actions" : {
"run" : {
"enabled" : true,
"script" : "deno run --allow-all .\/build.ts"
"actions": {
"run": {
"enabled": true,
"script": "deno run --allow-all .\/build.ts"
}
},
"identifier" : "8A6A0F7A-38A4-4D09-A31B-3FCADC7BC1CB",
"openLogOnRun" : "finish"
"identifier": "8A6A0F7A-38A4-4D09-A31B-3FCADC7BC1CB",
"openLogOnRun": "finish"
}
57 changes: 38 additions & 19 deletions NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,39 @@

## 28/7/20

- Added fine-grained options for the extension which can be defined at a global and per-workspace level. Should make using this with the Typescript extension installed a _little_ better (though I need to request a per-project off switch for the TS extension).
- Tried to add tasks for Deno: run and bundle. Complete nightmare piping the options into the commands, had to resort to some ugly looking shell scripts.
- Added fine-grained options for the extension which can be defined at a global
and per-workspace level. Should make using this with the Typescript extension
installed a _little_ better (though I need to request a per-project off switch
for the TS extension).
- Tried to add tasks for Deno: run and bundle. Complete nightmare piping the
options into the commands, had to resort to some ugly looking shell scripts.

## Next time

- A logo that tells of this extension's 0.1-ness.

## 14/7/20

- Decided to just accept limitations for now. Am trying to follow up on bugs with both Deno team and Panic.
- Made dependency caching an explicit command as it downloads third party code to your machine.
- Decided to just accept limitations for now. Am trying to follow up on bugs
with both Deno team and Panic.
- Made dependency caching an explicit command as it downloads third party code
to your machine.
- Did a bunch of extension config / README finessing

--

## Next time

- Ran out of steam after seeing that I need some support from Panic to make this complete.
- Maybe a lot. Just don't know how to proceed with some things that don't work.
- Ran out of steam after seeing that I need some support from Panic to make this
complete.
- Maybe a lot. Just don't know how to proceed with some things that don't
work.
- I guess use tee + send to Panic...
- ```{"jsonrpc":"2.0","result":[{"title":"Import 'openFile' from module \"./nova_utils.ts\"","kind":"quickfix","diagnostics":[{"range":{"start":{"line":14,"character":2},"end":{"line":14,"character":10}},"severity":1,"code":2304,"source":"deno-ts","message":"Cannot find name 'openFile'."}],"edit":{"documentChanges":[{"textDocument":{"uri":"file:///Volumes/Macintosh%20HD/Users/gwil/Projects/nova-deno/src/nova_deno.ts","version":1334},"edits":[{"range":{"start":{"line":5,"character":0},"end":{"line":5,"character":0}},"newText":"import { openFile } from \"./nova_utils.ts\";\n"}]}]}},{"title":"Add missing function declaration 'openFile'","kind":"quickfix","diagnostics":[{"range":{"start":{"line":14,"character":2},"end":{"line":14,"character":10}},"severity":1,"code":2304,"source":"deno-ts","message":"Cannot find name 'openFile'."}],"edit":{"documentChanges":[{"textDocument":{"uri":"file:///Volumes/Macintosh%20HD/Users/gwil/Projects/nova-deno/src/nova_deno.ts","version":1334},"edits":[{"range":{"start":{"line":194,"character":0},"end":{"line":194,"character":0}},"newText":"\nfunction openFile() {\nthrow new Error(\"Function not implemented.\");\n}\n"}]}]}}],"id":190}```
- Regarding definitions from other modules:
- ```{"jsonrpc":"2.0","result":[{"targetUri":"deno:/https/deno.land/x/vscode_languageserver_types%40v0.1.0/mod.ts","targetRange":{"start":{"line":4,"character":0},"end":{"line":3252,"character":0}},"targetSelectionRange":{"start":{"line":4,"character":0},"end":{"line":3252,"character":0}}}],"id":10}```
- Seems I need a way to override `textDocument/definition` so that I can request a virtual text document from deno
- `{"jsonrpc":"2.0","result":[{"title":"Import 'openFile' from module \"./nova_utils.ts\"","kind":"quickfix","diagnostics":[{"range":{"start":{"line":14,"character":2},"end":{"line":14,"character":10}},"severity":1,"code":2304,"source":"deno-ts","message":"Cannot find name 'openFile'."}],"edit":{"documentChanges":[{"textDocument":{"uri":"file:///Volumes/Macintosh%20HD/Users/gwil/Projects/nova-deno/src/nova_deno.ts","version":1334},"edits":[{"range":{"start":{"line":5,"character":0},"end":{"line":5,"character":0}},"newText":"import { openFile } from \"./nova_utils.ts\";\n"}]}]}},{"title":"Add missing function declaration 'openFile'","kind":"quickfix","diagnostics":[{"range":{"start":{"line":14,"character":2},"end":{"line":14,"character":10}},"severity":1,"code":2304,"source":"deno-ts","message":"Cannot find name 'openFile'."}],"edit":{"documentChanges":[{"textDocument":{"uri":"file:///Volumes/Macintosh%20HD/Users/gwil/Projects/nova-deno/src/nova_deno.ts","version":1334},"edits":[{"range":{"start":{"line":194,"character":0},"end":{"line":194,"character":0}},"newText":"\nfunction openFile() {\nthrow new Error(\"Function not implemented.\");\n}\n"}]}]}}],"id":190}`
- Regarding definitions from other modules:
- `{"jsonrpc":"2.0","result":[{"targetUri":"deno:/https/deno.land/x/vscode_languageserver_types%40v0.1.0/mod.ts","targetRange":{"start":{"line":4,"character":0},"end":{"line":3252,"character":0}},"targetSelectionRange":{"start":{"line":4,"character":0},"end":{"line":3252,"character":0}}}],"id":10}`
- Seems I need a way to override `textDocument/definition` so that I can
request a virtual text document from deno

## 12/7/20

Expand All @@ -35,8 +44,10 @@
- Why is this markdown file being sent to Deno LS?
- Oh, gotta only invoke deno.cache on the right files...
- I need to find some good types for LSP stuff... (see apply_workspace_edits)
- Investigated non-working code actions. I think this one is on Panic. Need to report.
- Did it. https://devforum.nova.app/t/code-actions-not-working-with-deno-lsp-how-can-i-diagnose/1058
- Investigated non-working code actions. I think this one is on Panic. Need to
report.
- Did it.
https://devforum.nova.app/t/code-actions-not-working-with-deno-lsp-how-can-i-diagnose/1058

## Next time

Expand All @@ -47,7 +58,8 @@
## 11/7/20 part 2

- Got esbuild working again
- Got format on save working, found a diversion between nova types and values being sent
- Got format on save working, found a diversion between nova types and values
being sent
- Still trying to figure out what a code lens is
- Put together a more complete list of things to implement

Expand All @@ -61,8 +73,12 @@

## 11/7/20

- So LSP has a bunch of standard commands like 'textDocument/formatting', 'textDocument/rename' etc
- Someone is already making an extension... found the same problem regarding completions (https://devforum.nova.app/t/bug-with-textdocument-completion/969). One salient difference is I'm making this extension with Deno itself.
- So LSP has a bunch of standard commands like 'textDocument/formatting',
'textDocument/rename' etc
- Someone is already making an extension... found the same problem regarding
completions
(https://devforum.nova.app/t/bug-with-textdocument-completion/969). One
salient difference is I'm making this extension with Deno itself.
- Which is good!
- Started building in more complex command support
- Starting taking code wholesale from apexskier's nova-typescript extension
Expand All @@ -83,9 +99,11 @@ How do you make an extension for nova?
- An Images folder for resources
- A CHANGELOG
- extension.png + @2x
- extension.json (pretty deep, check this out: https://github.com/apexskier/nova-typescript/blob/main/typescript.novaextension/extension.json
- extension.json (pretty deep, check this out:
https://github.com/apexskier/nova-typescript/blob/main/typescript.novaextension/extension.json
)
- a Scripts folder where the bundled version comes out, to be used as 'main' file
- a Scripts folder where the bundled version comes out, to be used as 'main'
file

That JSON file is where everything gets pointed out:

Expand All @@ -99,5 +117,6 @@ That JSON file is where everything gets pointed out:

How do I make that main file?

we register a new languageclient (https://github.com/apexskier/nova-typescript/blob/main/src/main.ts#L175)
then we'd register a bunch of commands with it.
we register a new languageclient
(https://github.com/apexskier/nova-typescript/blob/main/src/main.ts#L175) then
we'd register a bunch of commands with it.
30 changes: 20 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,37 @@

A Deno extension for Nova.

- LSP integration with all that brings: typechecking, intellisense, hover cards, etc.
- LSP integration with all that brings: typechecking, intellisense, hover cards,
etc.
- File linting
- Document formatting
- Symbol renaming
- Remote module support + caching

This represents a best effort. It has a few known bugs that need assistance from Panic or Deno — see this repo's issues.
This represents a best effort. It has a few known bugs that need assistance from
Panic or Deno — see this repo's issues.

## Outline

The entrypoint `mod.ts` exposes two exports: `activate` and `deactivate`, which are used by Panic's Nova.
The entrypoint `mod.ts` exposes two exports: `activate` and `deactivate`, which
are used by Panic's Nova.

The contents of these exports can be found in `src/nova_deno.ts`. This is where the LanguageClient is set up, commands are registered, listeners are set up, etc.
The contents of these exports can be found in `src/nova_deno.ts`. This is where
the LanguageClient is set up, commands are registered, listeners are set up,
etc.

Much (maybe most?) of the code in this repo has been based on, if not entirely copied from, [nova-typescript](https://github.com/apexskier/nova-typescript), which has many useful utilities that could apply to any LSP extension for Nova.
Much (maybe most?) of the code in this repo has been based on, if not entirely
copied from, [nova-typescript](https://github.com/apexskier/nova-typescript),
which has many useful utilities that could apply to any LSP extension for Nova.

## Developing

1. Open this project in Nova.
2. Select **Extensions -> Activate Project as Extension** in the menu bar (you will need to enable Extension development in the general section of Nova's preferences to do this).
3. Run the 'Bundle' command, which watches for changes and builds* to `deno.novaextension`.

* This project uses esbuild rather than Deno to build the project, as Nova expects the project's modules to be in CommonJS format.

2. Select **Extensions -> Activate Project as Extension** in the menu bar (you
will need to enable Extension development in the general section of Nova's
preferences to do this).
3. Run the 'Bundle' command, which watches for changes and builds* to
`deno.novaextension`.

- This project uses esbuild rather than Deno to build the project, as Nova
expects the project's modules to be in CommonJS format.
12 changes: 9 additions & 3 deletions deno.novaextension/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
## v0.3.1

- Refactored task templates so that they succeed more often and are easier to manage!

## v0.3

- Added per-workspace configs for import maps and tsconfig.json for the LSP to use.
- Added per-workspace configs for import maps and tsconfig.json for the LSP to
use.

## v0.2

- Added global and per-workspace configs for:
- Added global and per-workspace configs for:
- Language features
- Linting
- Format on save
- Unstable API support.
- Added built in Task Templates for `deno run` and `deno bundle`, which can be added and configured from **Project -> Project Settings**.
- Added built in Task Templates for `deno run` and `deno bundle`, which can be
added and configured from **Project -> Project Settings**.
- Fixed an issue where linting was not being enabled properly.
- Removed unnecessary network access entitlement.

Expand Down
29 changes: 20 additions & 9 deletions deno.novaextension/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
Very fast JavaScript and Typescript integration, powered by [Deno](https://deno.land).
Very fast JavaScript and Typescript integration, powered by
[Deno](https://deno.land).

- Inline Typechecking and Intellisense for Javascript and Typescript!
- Code linting!
- Automatic formatting on save!
- Remote module (e.g. `import { x } from "https://cdn.com/mod.ts"`) support!
- Task templates for `deno run` and `deno` bundle!

**This is pre-v1.0**. While the most important functions of Deno are integrated here, there are missing features and a few known bugs. This is a best-effort extension, but it might be good enough to start with!
**This is pre-v1.0**. While the most important functions of Deno are integrated
here, there are missing features and a few known bugs. This is a best-effort
extension, but it might be good enough to start with!

## Requirements 🎒

To use this extension, you must have the Deno CLI installed (v.1.10.3 or above). [Here's how you can do that](https://deno.land/#installation).
To use this extension, you must have the Deno CLI installed (v.1.10.3 or above).
[Here's how you can do that](https://deno.land/#installation).

## Commands ⌨️

Expand All @@ -20,7 +24,8 @@ To use this extension, you must have the Deno CLI installed (v.1.10.3 or above).

## Configuration options ⚙️

All of the below can be configured at a global and per-project basis (via **Project → Project Settings...**).
All of the below can be configured at a global and per-project basis (via
**Project → Project Settings...**).

- Format on save
- Deno language features
Expand All @@ -34,16 +39,22 @@ The following can be configured on a per-project lever:

## Known bugs 🪳

There are a few bugs which are out of my hands. I'm doing my best to follow up with both Panic and the Deno team to resolve them.
There are a few bugs which are out of my hands. I'm doing my best to follow up
with both Panic and the Deno team to resolve them.

- Many code actions (e.g. automatic imports) do not work.
- Autocompletions are only displayed when certain characters are input (`., \, ', /, @, <, #`).
- The **Jump to definition** command does not work for values defined within external dependencies.
- Autocompletions are only displayed when certain characters are input
(`., \, ', /, @, <, #`).
- The **Jump to definition** command does not work for values defined within
external dependencies.

## Mega Shoutouts 📣

Much of the code in this extension is based on — if not entirely lifted from — Cameron Little's [excellent Nova Typescript extension](https://github.com/apexskier/nova-typescript).
Much of the code in this extension is based on — if not entirely lifted from —
Cameron Little's
[excellent Nova Typescript extension](https://github.com/apexskier/nova-typescript).

## Contributing

This extension is itself a Deno project. [Come fix bugs and add features with us](https://github.com/sgwilym/nova-deno)!
This extension is itself a Deno project.
[Come fix bugs and add features with us](https://github.com/sgwilym/nova-deno)!
1 change: 0 additions & 1 deletion deno.novaextension/Scripts/bundle.sh

This file was deleted.

6 changes: 0 additions & 6 deletions deno.novaextension/Scripts/run.sh

This file was deleted.

Loading

0 comments on commit f646b52

Please sign in to comment.