Skip to content

Commit fa2d1a4

Browse files
committed
formating file lock and update onlineEdit account name image
1 parent ca046a9 commit fa2d1a4

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed
-51.5 KB
Loading

docs/usage/FileLock.md

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,32 @@ Optionally, a full exclusive and continuous pessimistic locking mode is availabl
2424
You can switch between the default optimistic mode and the pessimistic exclusive lock mode.
2525

2626
Steps:
27-
1. Open the `basic.mvbasic.json` file in your online editing project.
28-
2. Add or modify the property:
27+
28+
1. Open the `basic.mvbasic.json` file in your online editing project.
29+
2. Add or modify the property:
2930
```json
3031
{
3132
"file_lock_state": "ON" // or "OFF" (default optimistic)
3233
}
3334
```
34-
3. Save the configuration file.
35-
4. Reopen the BASIC program file for the setting to take effect.
35+
3. Save the configuration file.
36+
4. Reopen the BASIC program file for the setting to take effect.
3637

3738
Meaning:
39+
3840
- `ON`: Enables **pessimistic exclusive locking**. When a BASIC file is opened, an exclusive lock is held for the entire edit session. Other users attempting to open the same file receive a message: `This file is locked by another user.`
41+
3942
- `OFF` (default / if omitted): Enables **optimistic locking**. Multiple users can open the same file.
4043

4144
---
4245
### Pessimistic (Exclusive) Locking (file_lock_state = ON)
4346
Pessimistic locking assumes conflicts are likely. A lock is acquired when the file is opened and retained for the full editing session until the editor is closed or the file is otherwise released. This prevents others from opening the file.
4447

4548
Continuous locks can:
49+
50+
4651
- Block other developers for long periods.
52+
4753
- Increase the risk of stale locks if the editor crashes. In this case, the extension attempts cleanup, but external factors can interfere.
4854

4955
**When File is Already Locked:**
@@ -59,36 +65,42 @@ The file open operation will be aborted, and the file will not open in the edito
5965
---
6066
### Optimistic Locking (Default, file_lock_state = OFF)
6167
In optimistic mode you edit a local copy without holding a server lock. The extension:
68+
6269
- Acquires a short READ/validation lock/check when opening.
6370
- Releases it immediately after obtaining a clean copy.
6471
- Performs a conflict/lock check before saving (and may perform lightweight checks when an edit is made or when regaining focus) to ensure no exclusive lock is currently held elsewhere.
6572

6673
Advantages:
74+
6775
- Minimizes lock contention.
6876
- Improves scalability with many users.
6977
- Reduces risk of lingering locks after network issues.
7078

7179
Risk:
80+
7281
- Another user or external process could modify the server copy between your open and save. Your save then overwrites their changes (last-writer-wins) without merge.
7382

7483
Currently MVVS does **not** perform an automatic diff/merge or modification timestamp comparison before overwrite.
7584

7685
---
7786
### Save Workflow (Step-by-Step)
7887
Optimistic Mode (`file_lock_state` = OFF):
79-
1. the user triggers Save in VS Code.
80-
2. The extension performs an optimistic conflict/lock check, and attempts a short WRITE or validation lock.
81-
3. If the acquisition/check fails, a warning displays and the save is aborted. The remote file stays unchanged.
82-
4. If the check succeeds, a local copy is uploaded and the remote content is replaced.
83-
5. Any temporary lock is released immediately.
88+
89+
1. the user triggers Save in VS Code.
90+
2. The extension performs an optimistic conflict/lock check, and attempts a short WRITE or validation lock.
91+
3. If the acquisition/check fails, a warning displays and the save is aborted. The remote file stays unchanged.
92+
4. If the check succeeds, a local copy is uploaded and the remote content is replaced.
93+
5. Any temporary lock is released immediately.
8494

8595
Exclusive Mode (`file_lock_state` = ON):
86-
1. The file already has an exclusive lock from open.
87-
2. the user triggers Save and the write proceeds directly while the existing lock guarantees exclusivity.
88-
3. The lock is released when the editor/file is closed or project is unloaded.
96+
97+
1. The file already has an exclusive lock from open.
98+
2. the user triggers Save and the write proceeds directly while the existing lock guarantees exclusivity.
99+
3. The lock is released when the editor/file is closed or project is unloaded.
89100

90101
---
91102
### Best Practices for Teams
103+
92104
- Use `file_lock_state = ON` for highly critical or frequently contended programs where overwrites are unacceptable.
93105
- Use the default optimistic mode for general development to keep collaboration fluid.
94106
- Communicate when editing critical programs to avoid surprise overwrites (optimistic) or prolonged locks (exclusive).
@@ -108,6 +120,7 @@ Click Okay to overwrite the file.
108120
**User Actions & Outcomes:**
109121

110122
**Click Overwrite (Okay):**
123+
111124
- The file will be overwritten on the server, and you will see a confirmation message:
112125
```
113126
File saved successfully

0 commit comments

Comments
 (0)