-
Notifications
You must be signed in to change notification settings - Fork 21
[WIP] Svelte Language Server integration #277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
create LanguageClientProvider.svelte add utils to webcontainer.ts reflect new changes in Editor.svelte
Someone is attempting to deploy a commit to a Personal Account owned by @SvelteLab on Vercel. @SvelteLab first needs to authorize it. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
reorganize/clean up LanguageClientProvider.svelte format
add file watching for webcontainer fix languageclientprovider
get it working better
fixes editor loading
fixes timing issues, module resolution, ts server
cleanup a lil bit
update Editor/LangClientProvider w/ feature detection & optimize for FF
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First of all, thank you so much for all the time and effort you have poured into this project! It's amazing to see all the Language Server features like hover type definitions and import completion in SvelteLab 🚀
I've sent the preview deployment link to subscribers in the Discord. Feel free to also join :)
I've only had a quick peek at the PR for now and left some nitpicky comments for the low-hanging fruit. It'll take me a bit to read it fully and probably more to understand the implementation.
Also, I'm having trouble reliably opening the Editor. It often seems to hang or maybe it just takes a really long time to load??? 🤷
EDIT: ok its not loading i think it boots, installs deps, runs vite but the editor doesn't open, at least with ?t=typescript
EDIT EDIT: now it works?! it's kinda weird? 👀
.eslintignore
Outdated
@@ -11,3 +11,5 @@ node_modules | |||
pnpm-lock.yaml | |||
package-lock.json | |||
yarn.lock | |||
/src/lib/language_servers/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like these /src/lib/ stuff is still from before the language server worker was it's own module, right? 👀
.prettierignore
Outdated
/src/lib/lsp/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here, could possibily be removed
"codemirror-languageserver": "^1.11.0", | ||
"events": "^3.3.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these new modules (open-rpc, codemirror-languageserver, events) used anywhere? 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed open-rpc, and events. since they were required when using the language server modules directly rather than using the current NPM package. codemirror-languageserver
is used here, though: https://github.com/SvelteLab/SvelteLab/pull/277/files#diff-eb2ab2a29594e8de109dcc59d1e2664eb6b05c0107da708a5119794aef7f030aR275
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you could remove the formatting diff from default_project_files
that would be great, as that means the default projects aren't formatted according to the prettier config of the respective projects 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch -- my bad! I ran prettier globally from the NPM scripts -- would it be a good idea to add ./src/lib/default_project_files/*
to .prettierignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right! Our bad then, we should add that... Do you mind adding it? 🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we probably need a jsconfig/tsconfig for every project template, right? 🤔
return walk([''], '', file_tree); | ||
} | ||
|
||
function find_first_of_file_ext( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is cool! thx
), | ||
}; | ||
} | ||
} | ||
return tree; | ||
} | ||
|
||
const IGNORE_LIST = ['.svelte-kit', 'node_modules']; | ||
const IGNORE_LIST = ['.svelte-kit/generated', 'node_modules']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was this for debugging purposes, or do we need this? i think it makes the .svelte-kit folder appear in the file tree which we might not want
Fixes formatting for templates This reverts commit 455ad40.
@SarcevicAntonio What browser (and version), along with OS and maybe device/hardware youre running on, is having difficulties? If you're able to potentially provide me with at minimum browser + version, and some extensions you have installed (if any) I can probably repro and get it fixed before the end of the weekend 🚀 |
@@ -62,6 +62,9 @@ export default defineConfig({ | |||
define: { | |||
'process.env.NODE_ENV': '"production"', | |||
}, | |||
worker: { | |||
format: 'es', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we are also using a worker to search the sveltekit documentation and the es worker format is not supported by firefox...i don't think there's a way to have them built in different formats right?
rm `race` and run setup sequentially
Any updates here boys? |
I started working on a different version and I almost got it working locally...I need to find a bit of time to continue working on this |
Adds (nearly) full & complete Svelte Language Server + TypeScript/JavaScript language server support for compatible browsers.
Features include:
export let data
should provide correct types, for example)Code changes
Components
LanguageClientProvider.svelte
, which encapsulates access to the language server functionality (since everything is instantiated async, plus, we need to limit access to it due to the use of Web Workers)FileTree.svelte
to support updating/adding files to the language servers (https://github.com/SvelteLab/SvelteLab/pull/277/files#diff-4fc96a12a94550fd4403144a0bd814c3dadf0b0c2c59d00df88c80bcd28ce3daR44-R64)webcontainer.ts
FSChangedEvent
to have be of type'creation' | 'deletion' | 'modification'
(https://github.com/SvelteLab/SvelteLab/pull/277/files#diff-54c3b6b7253ed4f41dd02429026ab0da5c356c4941d071771717557fa4078249R105)*.svelte
file. Vite templates aren't normally going to have asrc/routes/+page.svelte
file, so we might as well meet the normal expectation presented to users when they open the app for the first time (https://github.com/SvelteLab/SvelteLab/pull/277/files#diff-54c3b6b7253ed4f41dd02429026ab0da5c356c4941d071771717557fa4078249R601-R604)get_directory_names
, afaict it's currently unused, however it might be a nicety later down the line -- although it's up to SvelteLab's maintainers if they want to keep this or not (https://github.com/SvelteLab/SvelteLab/pull/277/files#diff-54c3b6b7253ed4f41dd02429026ab0da5c356c4941d071771717557fa4078249R819-R840)walk_tree_and_collect
, which will walk a given file tree and return the typeRecord<PathToFile (string), FileContents (string)>
(https://github.com/SvelteLab/SvelteLab/pull/277/files#diff-54c3b6b7253ed4f41dd02429026ab0da5c356c4941d071771717557fa4078249R851-R879)get_tree
withignore_node_modules
parameter