Skip to content
Closed
32 changes: 32 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,33 @@
# Normalize all text files to LF in the repository
* text=auto eol=lf

# Common text/code files
*.js text eol=lf
*.ts text eol=lf
*.json text eol=lf
*.yml text eol=lf
*.yaml text eol=lf
*.md text eol=lf
*.css text eol=lf
*.html text eol=lf
*.xml text eol=lf
*.sh text eol=lf

# Windows scripts keep CRLF
*.bat text eol=crlf
*.cmd text eol=crlf

# Binary files
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.webp binary
*.ico binary
*.keystore binary
*.jks binary
*.jar binary
*.apk binary

# Change
*.sh text eol=lf
41 changes: 41 additions & 0 deletions .github/workflows/valid_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: CI

on:
pull_request:
branches: [main]
push:
branches: [main, work]
workflow_dispatch:

permissions:
contents: read

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
quality:
name: Linting and formatting
runs-on: ubuntu-24.04

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- name: Install dependencies
run: npm ci

- name: Run Biome CI
run: npx biome ci .

- name: Typecheck
run: npm run typecheck
22 changes: 22 additions & 0 deletions src/lib/editorManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ import quickTools from "components/quickTools";
import ScrollBar from "components/scrollbar";
import SideButton, { sideButtonContainer } from "components/sideButton";
import keyboardHandler, { keydownState } from "handlers/keyboard";
import {
createSnippetCompletionSource,
expandSnippetShortcut,
} from "lib/snippets";
import EditorFile from "./editorFile";
import openFile from "./openFile";
import { addedFolder } from "./openFolder";
Expand Down Expand Up @@ -1155,6 +1159,24 @@ async function EditorManager($header, $body) {
});
const exts = [...baseExtensions];
maybeAttachEmmetCompletions(exts, syntax);
const snippetLanguageId = getFileLanguageId(file);
exts.push(
EditorState.languageData.of(() => [
{
autocomplete: createSnippetCompletionSource(snippetLanguageId),
},
]),
);
exts.push(
Prec.high(
keymap.of([
{
key: "Tab",
run: (view) => expandSnippetShortcut(view, snippetLanguageId),
},
]),
),
);
Comment on lines +1162 to +1179
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Language ID is captured once per file-open, not per language switch

snippetLanguageId is evaluated once in applyFileToEditor and then closed over in both the completion source and the Tab keymap. If the user later changes the file's language (mode) without re-opening the file, the snippet engine will keep using the stale language ID. The existing languageCompartment.reconfigure() path won't update these closures. Consider deriving the language ID dynamically from the view's state inside both callbacks instead.

try {
const langExtFn = file.currentLanguageExtension;
let initialLang = [];
Expand Down
4 changes: 4 additions & 0 deletions src/lib/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ class Settings {
servers: {},
},
developerMode: false,
snippets: {
enabled: true,
user: {},
},
shiftClickSelection: false,
};
this.value = structuredClone(this.#defaultSettings);
Expand Down
Loading