Commit Graph

4 Commits

Author SHA1 Message Date
Kaz Wesley
582b7f9a2e
Fullscreen improvements (#10876)
Implements #10686.
- Add fullscreen modes to doc editor and code editor
- Contain fullscreen view within graph editor tab
- Prevent persisting or synchronizing fullscreen state
- Animate transition

https://github.com/user-attachments/assets/e88801c2-8c56-494b-8500-95fbd76c4322
2024-08-23 13:00:44 +00:00
Adam Obuchowicz
22263e8ff9
Y-docs: Fix write capability recovery (#10851)
When receiving no write capability in `text/openFile` response, the method returned error without synchronizing, but session state stayed at 'Opening' - this resulted in automatic success on the next retry without actually trying.

Added additional state to handle recovery from missing write capability errors.

# Important Notes
tested by applying the patch below (which simulates problem reported by James):

```diff
diff --git a/app/ydoc-shared/src/languageServer.ts b/app/ydoc-shared/src/languageServer.ts
index e1403f50420247575b437df8c603e5f1701b5e1d..753bbf9f9f449f6130c79040e44607ce0c308f7f 100644
--- a/app/ydoc-shared/src/languageServer.ts
+++ b/app/ydoc-shared/src/languageServer.ts
@@ -3,6 +3,7 @@ import { bytesToHex } from '@noble/hashes/utils'
import { Client, RequestManager } from '@open-rpc/client-js'
import debug from 'debug'
import { ObservableV2 } from 'lib0/observable'
+import { wait } from 'lib0/promise.js'
import { uuidv4 } from 'lib0/random'
import { z } from 'zod'
import { walkFs } from './languageServer/files'
@@ -268,9 +269,25 @@ export class LanguageServer extends ObservableV2<Notifications & TransportEvents
return this.request('session/initProtocolConnection', { clientId }, false)
}

+  private openCalls = 0
/** [Documentation](https://github.com/enso-org/enso/blob/develop/docs/language-server/protocol-language-server.md#textopenfile) */
openTextFile(path: Path): Promise<LsRpcResult<response.OpenTextFile>> {
-    return this.request<response.OpenTextFile>('text/openFile', { path })
+    if (this.openCalls === 0) {
+      this.openCalls = 1
+      return wait(1000).then(() =>
+        Err(new LsRpcError('Simluated timeout', 'text/openFile', { path })),
+      )
+    } else if (this.openCalls === 1) {
+      this.openCalls = 2
+      return this.request<response.OpenTextFile>('text/openFile', { path }).then(value => {
+        if (value.ok) {
+          value.value.writeCapability = null
+        }
+        return value
+      })
+    } else {
+      return this.request<response.OpenTextFile>('text/openFile', { path })
+    }
}

/** [Documentation](https://github.com/enso-org/enso/blob/develop/docs/language-server/protocol-language-server.md#textclosefile) */
```
2024-08-20 14:42:25 +00:00
Adam Obuchowicz
09c4b7a993
Fix file open retry in ydocs server (#10787)
There is a code for exponential back off, but the result with error was lost at one place.

Tested by mocking timeouts in our `lanugageServer.ts`

Fixes #10606
2024-08-12 09:57:29 +00:00
Paweł Grabarz
b286adaae4
Split ydoc server into separate module (#10735)
# Important Notes
The command to run the gui dev environment has been changed. Invoking the old command will print a message about that.
From now on, use `pnpm dev:gui2` in repository root.
2024-08-08 12:12:05 +00:00