gitlatex 1.5.2__tar.gz → 1.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gitlatex-1.5.2 → gitlatex-1.6.0}/PKG-INFO +6 -3
- {gitlatex-1.5.2 → gitlatex-1.6.0}/README.md +5 -2
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/__init__.py +1 -1
- gitlatex-1.6.0/gitlatex/public/js/editor/monaco.js +107 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/git/actions.js +14 -1
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/routes/git.py +10 -2
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex.egg-info/PKG-INFO +6 -3
- {gitlatex-1.5.2 → gitlatex-1.6.0}/pyproject.toml +1 -1
- gitlatex-1.5.2/gitlatex/public/js/editor/monaco.js +0 -98
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/__main__.py +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/app.py +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/http.py +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/app.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/bib-commands.json +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/css/base.css +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/css/console.css +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/css/docs.css +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/css/editor.css +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/css/home.css +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/css/layout.css +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/css/loading.css +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/css/outline.css +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/css/problems.css +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/css/settings.css +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/css/sidebar.css +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/css/support.css +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/css/toolbar.css +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/css/updates.css +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/css/versions.css +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/favicon.svg +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/index.html +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/build/compile.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/build/problems.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/core/api.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/core/filetypes.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/core/router.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/core/state.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/core/storage.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/editor/completions.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/editor/envcolors.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/editor/filetree.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/editor/languages.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/editor/mainfile.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/editor/outline.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/editor/projectindex.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/editor/session.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/editor/spell.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/git/diffview.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/git/menu.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/git/versions.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/home/repolist.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/ui/consolepane.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/ui/layout.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/ui/loading.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/ui/modals.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/ui/settings.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/ui/theme.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/js/ui/viewer.js +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/public/latex-commands.json +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/routes/__init__.py +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/routes/compile.py +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/routes/files.py +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/routes/pages.py +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/routes/projectindex.py +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/routes/repos.py +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/routes/spell.py +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/routes/system.py +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/server.py +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/services/__init__.py +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/services/git_backend.py +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/services/gitrepo.py +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/services/latex.py +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/services/paths.py +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/services/projectindex.py +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/services/spell.py +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/services/updates.py +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex/state.py +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex.egg-info/SOURCES.txt +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex.egg-info/dependency_links.txt +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex.egg-info/entry_points.txt +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex.egg-info/requires.txt +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/gitlatex.egg-info/top_level.txt +0 -0
- {gitlatex-1.5.2 → gitlatex-1.6.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitlatex
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6.0
|
|
4
4
|
Summary: A simple UI for LaTeX projects with Git support. Clone repos, edit, compile, and push.
|
|
5
5
|
License-Expression: ISC
|
|
6
6
|
Project-URL: Homepage, https://github.com/abdussamiakanda/gitlatex
|
|
@@ -152,8 +152,11 @@ powers VS Code.
|
|
|
152
152
|
|
|
153
153
|
### Git and version history
|
|
154
154
|
|
|
155
|
-
- **Status, diff, pull and push** from the toolbar. Push
|
|
156
|
-
|
|
155
|
+
- **Status, diff, pull and push** from the toolbar. Push asks for a commit message
|
|
156
|
+
(default: `Update LaTeX project`), then stages everything, commits and pushes.
|
|
157
|
+
Edit the message or accept the default; Cancel or Escape stops the
|
|
158
|
+
operation. Submitting an empty message also cancels. If the working tree is
|
|
159
|
+
clean, existing commits are pushed without creating an empty commit.
|
|
157
160
|
- Pull and push **enable themselves only when there is something to do**, with
|
|
158
161
|
ahead/behind counts read from the remote.
|
|
159
162
|
- **Version history panel** listing your commits, with the files each one touched
|
|
@@ -124,8 +124,11 @@ powers VS Code.
|
|
|
124
124
|
|
|
125
125
|
### Git and version history
|
|
126
126
|
|
|
127
|
-
- **Status, diff, pull and push** from the toolbar. Push
|
|
128
|
-
|
|
127
|
+
- **Status, diff, pull and push** from the toolbar. Push asks for a commit message
|
|
128
|
+
(default: `Update LaTeX project`), then stages everything, commits and pushes.
|
|
129
|
+
Edit the message or accept the default; Cancel or Escape stops the
|
|
130
|
+
operation. Submitting an empty message also cancels. If the working tree is
|
|
131
|
+
clean, existing commits are pushed without creating an empty commit.
|
|
129
132
|
- Pull and push **enable themselves only when there is something to do**, with
|
|
130
133
|
ahead/behind counts read from the remote.
|
|
131
134
|
- **Version history panel** listing your commits, with the files each one touched
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""GitLaTeX IDE - LaTeX projects with Git support."""
|
|
2
|
-
__version__ = "1.
|
|
2
|
+
__version__ = "1.6.0"
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loading Monaco and creating the one editor instance the app uses.
|
|
3
|
+
*
|
|
4
|
+
* ensureMonacoReady(cb) is the only entry point: it loads Monaco on first call,
|
|
5
|
+
* queues callbacks until it is ready, and runs them immediately after that.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { state } from "../core/state.js";
|
|
9
|
+
import { registerCompletions } from "./completions.js";
|
|
10
|
+
import { registerLanguages } from "./languages.js";
|
|
11
|
+
import { highlightOutlineFor, scheduleOutlineRefresh } from "./outline.js";
|
|
12
|
+
import { saveCurrentFile } from "./session.js";
|
|
13
|
+
import {
|
|
14
|
+
addWordToDictionary,
|
|
15
|
+
loadSpellStatus,
|
|
16
|
+
registerSpellCodeActions,
|
|
17
|
+
scheduleSpellCheck,
|
|
18
|
+
wordAtCursor,
|
|
19
|
+
} from "./spell.js";
|
|
20
|
+
import { getMonacoTheme } from "../ui/theme.js";
|
|
21
|
+
|
|
22
|
+
// ----- Editor page: init Monaco when needed -----
|
|
23
|
+
export function ensureMonacoReady(callback) {
|
|
24
|
+
if (state.monacoReady && state.editor) {
|
|
25
|
+
callback();
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
state.monacoReadyCallbacks.push(callback);
|
|
29
|
+
if (state.monacoReadyCallbacks.length > 1) return;
|
|
30
|
+
require.config({
|
|
31
|
+
paths: { vs: "https://unpkg.com/monaco-editor@latest/min/vs" },
|
|
32
|
+
});
|
|
33
|
+
require(["vs/editor/editor.main"], function () {
|
|
34
|
+
state.monacoApi = monaco;
|
|
35
|
+
registerLanguages(monaco);
|
|
36
|
+
|
|
37
|
+
const editorEl = document.getElementById("editor");
|
|
38
|
+
state.editor = monaco.editor.create(editorEl, {
|
|
39
|
+
value: "",
|
|
40
|
+
language: "latex",
|
|
41
|
+
theme: getMonacoTheme(),
|
|
42
|
+
wordWrap: "on",
|
|
43
|
+
quickSuggestions: { other: true, comments: true, strings: true },
|
|
44
|
+
suggestOnTriggerCharacters: true,
|
|
45
|
+
acceptSuggestionOnEnter: "on",
|
|
46
|
+
suggest: {
|
|
47
|
+
showWords: false,
|
|
48
|
+
showSnippets: true,
|
|
49
|
+
showKeywords: true,
|
|
50
|
+
showFunctions: true,
|
|
51
|
+
showClasses: true,
|
|
52
|
+
showModules: true,
|
|
53
|
+
showVariables: true,
|
|
54
|
+
showReferences: true,
|
|
55
|
+
showFiles: true,
|
|
56
|
+
matchOnWordStartOnly: false,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
registerCompletions(monaco);
|
|
61
|
+
|
|
62
|
+
// Spelling: squiggles, quick fixes and the "add to dictionary" command.
|
|
63
|
+
registerSpellCodeActions(monaco);
|
|
64
|
+
// Right-click entry, for adding the word under the cursor without going
|
|
65
|
+
// through the lightbulb.
|
|
66
|
+
state.editor.addAction({
|
|
67
|
+
id: "gitlatex.addToDictionary.context",
|
|
68
|
+
label: "Add Word to Dictionary",
|
|
69
|
+
contextMenuGroupId: "1_modification",
|
|
70
|
+
contextMenuOrder: 3,
|
|
71
|
+
run: function (ed) {
|
|
72
|
+
addWordToDictionary(wordAtCursor(ed));
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
loadSpellStatus();
|
|
76
|
+
|
|
77
|
+
let autosaveTimeout = null;
|
|
78
|
+
const AUTOSAVE_DELAY_MS = 800;
|
|
79
|
+
state.editor.onDidChangeModelContent(() => {
|
|
80
|
+
clearTimeout(autosaveTimeout);
|
|
81
|
+
autosaveTimeout = setTimeout(() => {
|
|
82
|
+
if (state.currentFile) saveCurrentFile();
|
|
83
|
+
}, AUTOSAVE_DELAY_MS);
|
|
84
|
+
scheduleOutlineRefresh();
|
|
85
|
+
scheduleSpellCheck();
|
|
86
|
+
});
|
|
87
|
+
state.editor.onDidChangeCursorPosition((e) => {
|
|
88
|
+
highlightOutlineFor(e.position.lineNumber);
|
|
89
|
+
});
|
|
90
|
+
function layoutEditor() {
|
|
91
|
+
if (state.editor && editorEl) {
|
|
92
|
+
const w = Math.max(editorEl.offsetWidth || 0, 200);
|
|
93
|
+
const h = Math.max(editorEl.offsetHeight || 0, 320);
|
|
94
|
+
state.editor.layout({ width: w, height: h });
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
layoutEditor();
|
|
98
|
+
setTimeout(layoutEditor, 0);
|
|
99
|
+
window.addEventListener("resize", layoutEditor);
|
|
100
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
101
|
+
new ResizeObserver(layoutEditor).observe(editorEl);
|
|
102
|
+
}
|
|
103
|
+
state.monacoReady = true;
|
|
104
|
+
state.monacoReadyCallbacks.forEach((cb) => cb());
|
|
105
|
+
state.monacoReadyCallbacks = [];
|
|
106
|
+
});
|
|
107
|
+
}
|
|
@@ -8,13 +8,26 @@ import { loadFile, loadFiles, saveCurrentFile } from "../editor/session.js";
|
|
|
8
8
|
import { invalidateVersions } from "./diffview.js";
|
|
9
9
|
import { loadCommits, openVersionsPanel } from "./versions.js";
|
|
10
10
|
import { ensureConsoleVisible, setConsole } from "../ui/consolepane.js";
|
|
11
|
+
import { showInputModal } from "../ui/modals.js";
|
|
11
12
|
|
|
12
13
|
export async function pushChanges() {
|
|
14
|
+
const message = await showInputModal({
|
|
15
|
+
title: "Commit and push",
|
|
16
|
+
label: "Commit message",
|
|
17
|
+
defaultValue: "Update LaTeX project",
|
|
18
|
+
submitLabel: "Commit and push"
|
|
19
|
+
});
|
|
20
|
+
if (message === null) return;
|
|
21
|
+
|
|
13
22
|
ensureConsoleVisible();
|
|
14
23
|
setConsole("Committing and pushing...");
|
|
15
24
|
try {
|
|
16
25
|
if (state.currentFile) await saveCurrentFile();
|
|
17
|
-
const res = await fetchApi("/push", {
|
|
26
|
+
const res = await fetchApi("/push", {
|
|
27
|
+
method: "POST",
|
|
28
|
+
headers: { "Content-Type": "application/json" },
|
|
29
|
+
body: JSON.stringify({ message })
|
|
30
|
+
});
|
|
18
31
|
const data = await res.json();
|
|
19
32
|
if (data.error) {
|
|
20
33
|
setConsole("Push error: " + data.error);
|
|
@@ -19,14 +19,22 @@ def push():
|
|
|
19
19
|
return jsonify(error="No repository selected"), 400
|
|
20
20
|
if Repo is None:
|
|
21
21
|
return jsonify(error="GitPython not installed"), 500
|
|
22
|
+
payload = request.get_json(silent=True)
|
|
23
|
+
if payload is None:
|
|
24
|
+
payload = {}
|
|
25
|
+
if not isinstance(payload, dict):
|
|
26
|
+
return jsonify(error="Expected a JSON object"), 400
|
|
27
|
+
message = payload.get("message", "")
|
|
28
|
+
if not isinstance(message, str):
|
|
29
|
+
return jsonify(error="Commit message must be a string"), 400
|
|
30
|
+
message = message.strip() or datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
|
22
31
|
try:
|
|
23
32
|
repo = Repo(state.current_repo_path)
|
|
24
33
|
try:
|
|
25
|
-
# Stage and commit everything with
|
|
34
|
+
# Stage and commit everything with the supplied message, then push.
|
|
26
35
|
committed = False
|
|
27
36
|
repo.git.add("-A")
|
|
28
37
|
if repo.is_dirty(index=True, working_tree=True, untracked_files=True):
|
|
29
|
-
message = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
|
30
38
|
repo.index.commit(message)
|
|
31
39
|
committed = True
|
|
32
40
|
print("Commit:", message)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitlatex
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.6.0
|
|
4
4
|
Summary: A simple UI for LaTeX projects with Git support. Clone repos, edit, compile, and push.
|
|
5
5
|
License-Expression: ISC
|
|
6
6
|
Project-URL: Homepage, https://github.com/abdussamiakanda/gitlatex
|
|
@@ -152,8 +152,11 @@ powers VS Code.
|
|
|
152
152
|
|
|
153
153
|
### Git and version history
|
|
154
154
|
|
|
155
|
-
- **Status, diff, pull and push** from the toolbar. Push
|
|
156
|
-
|
|
155
|
+
- **Status, diff, pull and push** from the toolbar. Push asks for a commit message
|
|
156
|
+
(default: `Update LaTeX project`), then stages everything, commits and pushes.
|
|
157
|
+
Edit the message or accept the default; Cancel or Escape stops the
|
|
158
|
+
operation. Submitting an empty message also cancels. If the working tree is
|
|
159
|
+
clean, existing commits are pushed without creating an empty commit.
|
|
157
160
|
- Pull and push **enable themselves only when there is something to do**, with
|
|
158
161
|
ahead/behind counts read from the remote.
|
|
159
162
|
- **Version history panel** listing your commits, with the files each one touched
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Loading Monaco and creating the one editor instance the app uses.
|
|
3
|
-
*
|
|
4
|
-
* ensureMonacoReady(cb) is the only entry point: it loads Monaco on first call,
|
|
5
|
-
* queues callbacks until it is ready, and runs them immediately after that.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { state } from "../core/state.js";
|
|
9
|
-
import { registerCompletions } from "./completions.js";
|
|
10
|
-
import { registerLanguages } from "./languages.js";
|
|
11
|
-
import { highlightOutlineFor, scheduleOutlineRefresh } from "./outline.js";
|
|
12
|
-
import { saveCurrentFile } from "./session.js";
|
|
13
|
-
import { addWordToDictionary, loadSpellStatus, registerSpellCodeActions, scheduleSpellCheck, wordAtCursor } from "./spell.js";
|
|
14
|
-
import { getMonacoTheme } from "../ui/theme.js";
|
|
15
|
-
|
|
16
|
-
// ----- Editor page: init Monaco when needed -----
|
|
17
|
-
export function ensureMonacoReady(callback) {
|
|
18
|
-
if (state.monacoReady && state.editor) {
|
|
19
|
-
callback();
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
state.monacoReadyCallbacks.push(callback);
|
|
23
|
-
if (state.monacoReadyCallbacks.length > 1) return;
|
|
24
|
-
require.config({ paths: { vs: "https://unpkg.com/monaco-editor@latest/min/vs" } });
|
|
25
|
-
require(["vs/editor/editor.main"], function () {
|
|
26
|
-
state.monacoApi = monaco;
|
|
27
|
-
registerLanguages(monaco);
|
|
28
|
-
|
|
29
|
-
const editorEl = document.getElementById("editor");
|
|
30
|
-
state.editor = monaco.editor.create(editorEl, {
|
|
31
|
-
value: "",
|
|
32
|
-
language: "latex",
|
|
33
|
-
theme: getMonacoTheme(),
|
|
34
|
-
quickSuggestions: { other: true, comments: true, strings: true },
|
|
35
|
-
suggestOnTriggerCharacters: true,
|
|
36
|
-
acceptSuggestionOnEnter: "on",
|
|
37
|
-
suggest: {
|
|
38
|
-
showWords: false,
|
|
39
|
-
showSnippets: true,
|
|
40
|
-
showKeywords: true,
|
|
41
|
-
showFunctions: true,
|
|
42
|
-
showClasses: true,
|
|
43
|
-
showModules: true,
|
|
44
|
-
showVariables: true,
|
|
45
|
-
showReferences: true,
|
|
46
|
-
showFiles: true,
|
|
47
|
-
matchOnWordStartOnly: false
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
registerCompletions(monaco);
|
|
52
|
-
|
|
53
|
-
// Spelling: squiggles, quick fixes and the "add to dictionary" command.
|
|
54
|
-
registerSpellCodeActions(monaco);
|
|
55
|
-
// Right-click entry, for adding the word under the cursor without going
|
|
56
|
-
// through the lightbulb.
|
|
57
|
-
state.editor.addAction({
|
|
58
|
-
id: "gitlatex.addToDictionary.context",
|
|
59
|
-
label: "Add Word to Dictionary",
|
|
60
|
-
contextMenuGroupId: "1_modification",
|
|
61
|
-
contextMenuOrder: 3,
|
|
62
|
-
run: function (ed) {
|
|
63
|
-
addWordToDictionary(wordAtCursor(ed));
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
loadSpellStatus();
|
|
67
|
-
|
|
68
|
-
let autosaveTimeout = null;
|
|
69
|
-
const AUTOSAVE_DELAY_MS = 800;
|
|
70
|
-
state.editor.onDidChangeModelContent(() => {
|
|
71
|
-
clearTimeout(autosaveTimeout);
|
|
72
|
-
autosaveTimeout = setTimeout(() => {
|
|
73
|
-
if (state.currentFile) saveCurrentFile();
|
|
74
|
-
}, AUTOSAVE_DELAY_MS);
|
|
75
|
-
scheduleOutlineRefresh();
|
|
76
|
-
scheduleSpellCheck();
|
|
77
|
-
});
|
|
78
|
-
state.editor.onDidChangeCursorPosition((e) => {
|
|
79
|
-
highlightOutlineFor(e.position.lineNumber);
|
|
80
|
-
});
|
|
81
|
-
function layoutEditor() {
|
|
82
|
-
if (state.editor && editorEl) {
|
|
83
|
-
const w = Math.max(editorEl.offsetWidth || 0, 200);
|
|
84
|
-
const h = Math.max(editorEl.offsetHeight || 0, 320);
|
|
85
|
-
state.editor.layout({ width: w, height: h });
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
layoutEditor();
|
|
89
|
-
setTimeout(layoutEditor, 0);
|
|
90
|
-
window.addEventListener("resize", layoutEditor);
|
|
91
|
-
if (typeof ResizeObserver !== "undefined") {
|
|
92
|
-
new ResizeObserver(layoutEditor).observe(editorEl);
|
|
93
|
-
}
|
|
94
|
-
state.monacoReady = true;
|
|
95
|
-
state.monacoReadyCallbacks.forEach(cb => cb());
|
|
96
|
-
state.monacoReadyCallbacks = [];
|
|
97
|
-
});
|
|
98
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|