The two tests provide somewhat limited value at this time: The Firefox
tests were green before, but we think that should not have been the case
as firefox does not accept the imports in the webworker when serving
with vite in dev mode -- which we did.
Trying to change the test to use the actual generated site fails for
unknown reason: Cypress claims the page reported by `vite prefix` as up
is returning 404 in CI. It works fine locally:-/
This might make firefox a bit happier as the (now) last import defines
some constants. That used to happen between imports and is after all
other imports now.
Ugly work-around, but maybe it helps?
... that communicate with each other over a channel. This means we can
pass one side into a web worker and still have this work.
Short-term this is mean to enable the LSP running in a web worker take
control of the Preview. Mid-term we might be able to also move the
preview into a web worker, but that needs OffScreenCanvas, which is not
available in Safari-based browsers at this time.
I had the mental model of "updating the preview with the new code" since
that is how the LSP works. That is of course wrong here: The Previewer always
compiles again from scratch.
So always feed the main source file to the preview, not the currently
edited one.
Fixes: #2057
This changes how the selection range is picked: Instead of using the
`QualifiedName` of the root element, look at the Component's
`DeclaredIdentifier`.
This fixes component declarations without `inherits` clause and is also
nicer than the old approach: We would use the Component id as a name of
the DocumentSymbol and set the inherited type name as selection range.
This is simpler than the previous version and will be easier to
reuse for line-wise deletion, too.
It does sacrifice indention level based (line-) comment splitting, but I
think that will not be missed...
Any comments up to a blank line _before_ a property will be considered to
belong to that property and any comment _after_ the property that starts
without a line break are part of a property now.
There is some extra magic to work when several properties are in the
same line: Basically all comments then refer to the following property.
Update tests accordingly...
Find the elements indentation level and make sure the following property
is indented.
This is a simplistic though as it indents 4 spaces more than the
Element's indentation level.
- Make the browser extention preview work
- Enable the properties tab on rust files
- Only call `offset_to_position_mapper` if the token is valid,
otherwise we might get an error visible in the UI.
This allows the OffsetToPositionMapper to not have a lifetime and
prevents it from holding a reference to the DocumentCache.
This makes things a lot as the OffsetToPositionMapper does not block
other uses of the DocumentCache anymore!
Extend the setBinding command of the LSP to also handle properties that
were declared but not defined yet.
This will enable us to add new properties (that were already declared
before).