Commit graph

359 commits

Author SHA1 Message Date
Olivier Goffart
31a830e66d viewer: when watching, we also need to watch the main file 2021-04-15 15:05:09 +02:00
Olivier Goffart
0e69ac1036 LSP: Auto complete the class names 2021-04-14 19:19:51 +02:00
Olivier Goffart
a3d29c6ba0 LSP: Jump to definition when the cursor is in a import statement 2021-04-14 18:50:12 +02:00
Olivier Goffart
130cc22207 LSP: fix completion or go to symbol of the file url constains special characters
such as space or so.
We were not decoding the URL properly if the URL was encoded
2021-04-14 18:09:44 +02:00
Olivier Goffart
9ce63b80b9 VS extension: Add a status bar bar item with status of the preview 2021-04-14 15:01:25 +02:00
Olivier Goffart
84e0b24550 Some refactoring of the syntax_nodes module
Ensure that the node always contains the write kind by panicking
if it doesn't.

Add some documentation for the macro that declares them
2021-04-14 11:46:49 +02:00
Simon Hausmann
36cbe0b342 Fix build
Amends commit afe3df6381

These functions were removed and need to be re-added in a different way in the interpreter for async
loading/embedding later
2021-04-14 11:01:43 +02:00
Simon Hausmann
afe3df6381 Remove the public API for registering fonts by path or memory chunk
This is not needed anymore in the light of being able to write `import "blah.ttf"` in .60 markup
2021-04-14 10:01:33 +02:00
Olivier Goffart
7a65f31cc1 the source_file is not optional 2021-04-13 17:26:24 +02:00
Olivier Goffart
84501e630a Rename SyntaxNodeWithSourceFile to SyntaxNode
Same for SyntaxToken
2021-04-13 17:10:56 +02:00
Olivier Goffart
5c795e7bab Use SyntaxNodeWithSourceFile everywhere instead of SyntaxNode 2021-04-13 17:10:56 +02:00
Olivier Goffart
15298f5626 Add the --auto-reload option to the viewer 2021-04-13 13:55:01 +02:00
Olivier Goffart
de090ccd1d Add missing file 2021-04-13 10:43:54 +02:00
Olivier Goffart
471c2eb9f8 Updator from 0.0.5 2021-04-13 10:33:20 +02:00
Olivier Goffart
bc757d2367 LSP: disable the debug tooltip 2021-04-12 19:54:50 +02:00
Simon Hausmann
ae5eb7b24a Fix updates of the preview on Windows
Use the same cannonical path for `preview::load_preview` and `preview::set_contents`.
Rust's `cannonicalize()` function produces a UNC path, so it's important to use
on both call sites to that we can find the same doc.
2021-04-09 17:56:49 +02:00
Simon Hausmann
5e8b738b70 Don't automatically show the preview window when reloading
When the user closes the window explicitly, don't make it suddnely pop up again when editing the .60.
2021-04-09 10:32:03 +02:00
Olivier Goffart
8a08e06ee0 LSP: fix completion of properties for local items 2021-04-08 07:54:15 +02:00
Olivier Goffart
81ebb2177e LSP: completion of properties 2021-04-07 23:55:46 +02:00
Olivier Goffart
4f35865a00 Fix panic of the LSP when queriing a token that is not in the document
This can happen in case of parse error, then the document don't constains all the tokens
2021-04-07 11:58:42 +02:00
Olivier Goffart
4aa18feba9 Remove debug output 2021-04-07 08:58:31 +02:00
Olivier Goffart
b195f1be96 LSP preview: use the cache from the LSP, and refresh when the content change 2021-04-06 13:18:37 +02:00
Simon Hausmann
33a9a40e55 Remove outdated comment
Amends 1e4921de13
2021-04-06 13:12:59 +02:00
Simon Hausmann
af33d439a9 Simplify LSP thread startup
After commit 1e4921de13 we don't need wait anymore,
the preview requests themselves will be queued.
2021-04-06 12:44:13 +02:00
Simon Hausmann
1e4921de13 Fix LSP server staying alive when closing preview window
* Provide an internal behavior parameter to run_event_loop() that we can use
from the preview to not quit when the last window was closed.
* Fix Drop for the winit event loop GraphicsWindow to drop the backend window correctly
  when unmapping, not when the graphics window dies. Otherwise QuitOnLastWindowClosed doesn't work.
2021-04-06 12:11:55 +02:00
Simon Hausmann
b81803774b Start the LSP thread when the gui thread is ready
This way we can serve preview requests immediately.

This basically makes post_event safe to call before the event loop is entered.
The events will be queued up and sent when the event loop
is created and we have access
to the proxy, which will take over the queue.
2021-04-06 11:40:17 +02:00
Simon Hausmann
d9db07db2a Try to gracefully terminate the LSP server when requested 2021-04-06 11:10:30 +02:00
Simon Hausmann
121a098f74 Fix lsp startup
Copy & paste brown paper bag for me for not calling the function :)
2021-04-06 11:05:05 +02:00
Simon Hausmann
9f2924a642 Begin swapping the event loops in the lsp
Run the preview in the main thread, as required for winit, and run the LSP
main loop in a secondary thread.

At least three more follow-up changes are needed, but this gets the
preview showing for example on macOS.
2021-04-06 10:40:34 +02:00
Olivier Goffart
0cd13d245d LSP: better diagnostic reporting
Don't put the filename in the message, it is already there.
Also handle Warnings as Warnings
2021-04-04 14:48:50 +02:00
Olivier Goffart
309a9274e1 LSP: preview window
Currently not yet live preview from the open document content, but that should totaly be doable
2021-04-03 10:00:12 +02:00
Simon Hausmann
87b320f216 Fix LSP on Windows
Use `to_file_path` to extract the correct path. Just calling `path()` will return something
like `//%3a/Users/blah` instead of `c:\Users\blah`
2021-04-01 13:44:10 +02:00
Simon Hausmann
ffe4ba84b5 Fix LSP diagnostics not disappearing when fixed
To clear diagnostics we must send out empty ones. That means we must always send them for all loaded files and the main file.
2021-03-31 20:47:42 +02:00
Simon Hausmann
4a9cd954b8 Rework the Rust entry point API for the interpreter
Switch to the stateful `ComponentCompiler` concept that we discussed for the C++ API.
2021-03-18 18:20:50 +01:00
Simon Hausmann
3391aa0312 Remove the import resolve callback from the compiler configuration
Re-apply commit 2dcbc45cd6 but now do the
resolution from a relative import path to either an absolute path or url
in the compiler itself.
2021-03-16 14:21:33 +01:00
Simon Hausmann
e3a33dffe0 Revert "Remove the import resolve callback from the compiler configuration"
This reverts commit 2dcbc45cd6.

It breaks loading of the printer demo in the editor because in
import_file we fail to return the absolute path and thus end up
importing common.60 too many times.
2021-03-16 11:43:33 +01:00
Simon Hausmann
2dcbc45cd6 Remove the import resolve callback from the compiler configuration
It turns out that this isn't really needed with the current
implementation.
2021-03-15 20:02:46 +01:00
Olivier Goffart
48333370a6 Use the new interpreter API in things that depends on it 2021-03-15 17:29:27 +01:00
Olivier Goffart
cae88f0823 Create a Diagnostic quen the main .60 file can't be loaded 2021-03-15 11:44:20 +01:00
Olivier Goffart
014e13b05f Make Diagnostic field private 2021-03-15 10:37:24 +01:00
Olivier Goffart
730b1ccff2 Refactor diagnostic: Merge BuildDiagnostic and FileDiagnostic 2021-03-12 19:32:50 +01:00
Olivier Goffart
11e0be5130 Add the SourceLocation into the Diagnostic 2021-03-12 12:49:19 +01:00
Olivier Goffart
968dfaae87 Put what is the FileDiagnostics into the SourceFile so the SourceFile has the content 2021-03-11 16:23:46 +01:00
Simon Hausmann
409475aed2 Rename viewer --font=blah.ttf to viewer --load-font=blah.ttf 2021-02-17 15:30:20 +01:00
Simon Hausmann
f30cb7f4d8 Add support for font_url params to the online editor and previewer 2021-02-17 15:28:18 +01:00
Simon Hausmann
445ddd58d5 API cleanup
Remove the `application` infix from `register_application_font`, to
reduce the changes that it might be interpreted to be a function that
also changes the default font in all text elements.
2021-02-17 14:37:31 +01:00
Simon Hausmann
45fe6c3e8d Add the ability to load application fonts by path
The viewer command line tool also gains the ability to specify them via `--app-font=/path/to/font.ttf` , which can be specified multiple times.
2021-02-17 14:16:52 +01:00
Simon Hausmann
7cea088a2c Add support for letter-spacing in text
This is conveniently supported by femtovg and Qt
2021-02-16 22:14:50 +01:00
Olivier Goffart
1d1d42bec1 Figma import: fix images importing 2021-02-12 21:40:34 +01:00
Olivier Goffart
670bef069d Figma import: Warning insted of generating wrong code for unsupported gradients 2021-02-12 20:47:59 +01:00