@lvce-editor/shared-process 0.0.36 → 0.0.37

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.
@@ -0,0 +1,14 @@
1
+ # Language Basics Bat
2
+
3
+ ## Contributing
4
+
5
+ ```sh
6
+ git clone git@github.com:lvce-editor/language-basics-bat.git &&
7
+ cd language-basics-bat &&
8
+ npm ci &&
9
+ npm test
10
+ ```
11
+
12
+ ## Gitpod
13
+
14
+ [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/lvce-editor/language-basics-bat)
@@ -0,0 +1,12 @@
1
+ {
2
+ "id": "builtin.language-basics-bat",
3
+ "name": "Language Basics Bat",
4
+ "description": "Provides syntax highlighting and bracket matching in Windows batch files.",
5
+ "languages": [
6
+ {
7
+ "id": "bat",
8
+ "extensions": [".bat", ".cmd"],
9
+ "tokenize": "src/tokenizeBat.js"
10
+ }
11
+ ]
12
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @enum number
3
+ */
4
+ export const TokenType = {
5
+ Text: 0,
6
+ NewLine: 1,
7
+ }
8
+
9
+ export const TokenMap = {
10
+ [TokenType.Text]: 'Text',
11
+ }
12
+
13
+ export const initialLineState = {
14
+ state: 1,
15
+ }
16
+
17
+ export const tokenizeLine = (line, lineState) => {
18
+ if (line.length === 0) {
19
+ return {
20
+ state: 1,
21
+ tokens: [],
22
+ }
23
+ }
24
+ return {
25
+ state: 1,
26
+ tokens: [
27
+ {
28
+ type: TokenType.Text,
29
+ length: line.length,
30
+ },
31
+ ],
32
+ }
33
+ }
@@ -0,0 +1,14 @@
1
+ # Language Basics Desktop
2
+
3
+ ## Contributing
4
+
5
+ ```sh
6
+ git clone git@github.com:lvce-editor/language-basics-desktop.git &&
7
+ cd language-basics-desktop &&
8
+ npm ci &&
9
+ npm test
10
+ ```
11
+
12
+ ## Gitpod
13
+
14
+ [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/lvce-editor/language-basics-desktop)
@@ -0,0 +1,12 @@
1
+ {
2
+ "id": "builtin.language-basics-desktop",
3
+ "name": "Language Basics desktop",
4
+ "description": "Provides syntax highlighting and bracket matching in desktop files.",
5
+ "languages": [
6
+ {
7
+ "id": "desktop",
8
+ "extensions": [".desktop"],
9
+ "tokenize": "src/tokenizeDesktop.js"
10
+ }
11
+ ]
12
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @enum number
3
+ */
4
+ export const TokenType = {
5
+ Text: 0,
6
+ NewLine: 1,
7
+ }
8
+
9
+ export const TokenMap = {
10
+ [TokenType.Text]: 'Text',
11
+ }
12
+
13
+ export const initialLineState = {
14
+ state: 1,
15
+ }
16
+
17
+ export const tokenizeLine = (line, lineState) => {
18
+ if (line.length === 0) {
19
+ return {
20
+ state: 1,
21
+ tokens: [],
22
+ }
23
+ }
24
+ return {
25
+ state: 1,
26
+ tokens: [
27
+ {
28
+ type: TokenType.Text,
29
+ length: line.length,
30
+ },
31
+ ],
32
+ }
33
+ }
@@ -0,0 +1,14 @@
1
+ # Language Basics Powershell
2
+
3
+ ## Contributing
4
+
5
+ ```sh
6
+ git clone git@github.com:lvce-editor/language-basics-powershell.git &&
7
+ cd language-basics-powershell &&
8
+ npm ci &&
9
+ npm test
10
+ ```
11
+
12
+ ## Gitpod
13
+
14
+ [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/lvce-editor/language-basics-powershell)
@@ -0,0 +1,12 @@
1
+ {
2
+ "id": "builtin.language-basics-powershell",
3
+ "name": "Language Basics powershell",
4
+ "description": "Provides syntax highlighting and bracket matching in Windows powershellch files.",
5
+ "languages": [
6
+ {
7
+ "id": "powershell",
8
+ "extensions": [".ps1", ".psm1", ".psd1", ".pssc", ".psrc"],
9
+ "tokenize": "src/tokenizePowershell.js"
10
+ }
11
+ ]
12
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @enum number
3
+ */
4
+ export const TokenType = {
5
+ Text: 0,
6
+ NewLine: 1,
7
+ }
8
+
9
+ export const TokenMap = {
10
+ [TokenType.Text]: 'Text',
11
+ }
12
+
13
+ export const initialLineState = {
14
+ state: 1,
15
+ }
16
+
17
+ export const tokenizeLine = (line, lineState) => {
18
+ if (line.length === 0) {
19
+ return {
20
+ state: 1,
21
+ tokens: [],
22
+ }
23
+ }
24
+ return {
25
+ state: 1,
26
+ tokens: [
27
+ {
28
+ type: TokenType.Text,
29
+ length: line.length,
30
+ },
31
+ ],
32
+ }
33
+ }
@@ -0,0 +1,14 @@
1
+ # Language Basics XML
2
+
3
+ ## Contributing
4
+
5
+ ```sh
6
+ git clone git@github.com:lvce-editor/language-basics-xml.git &&
7
+ cd language-basics-xml &&
8
+ npm ci &&
9
+ npm test
10
+ ```
11
+
12
+ ## Gitpod
13
+
14
+ [![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/lvce-editor/language-basics-xml)
@@ -0,0 +1,75 @@
1
+ {
2
+ "id": "builtin.language-basics-xml",
3
+ "name": "Language Basics XML",
4
+ "description": "Provides syntax highlighting and bracket matching in XML files.",
5
+ "languages": [
6
+ {
7
+ "id": "xml",
8
+ "extensions": [
9
+ ".xml",
10
+ ".xsd",
11
+ ".ascx",
12
+ ".atom",
13
+ ".axml",
14
+ ".axaml",
15
+ ".bpmn",
16
+ ".cpt",
17
+ ".csl",
18
+ ".csproj",
19
+ ".csproj.user",
20
+ ".dita",
21
+ ".ditamap",
22
+ ".dtd",
23
+ ".ent",
24
+ ".mod",
25
+ ".dtml",
26
+ ".fsproj",
27
+ ".fxml",
28
+ ".iml",
29
+ ".isml",
30
+ ".jmx",
31
+ ".launch",
32
+ ".menu",
33
+ ".mxml",
34
+ ".nuspec",
35
+ ".opml",
36
+ ".owl",
37
+ ".proj",
38
+ ".props",
39
+ ".pt",
40
+ ".publishsettings",
41
+ ".pubxml",
42
+ ".pubxml.user",
43
+ ".rbxlx",
44
+ ".rbxmx",
45
+ ".rdf",
46
+ ".rng",
47
+ ".rss",
48
+ ".shproj",
49
+ ".storyboard",
50
+ ".svg",
51
+ ".targets",
52
+ ".tld",
53
+ ".tmx",
54
+ ".vbproj",
55
+ ".vbproj.user",
56
+ ".vcxproj",
57
+ ".vcxproj.filters",
58
+ ".wsdl",
59
+ ".wxi",
60
+ ".wxl",
61
+ ".wxs",
62
+ ".xaml",
63
+ ".xbl",
64
+ ".xib",
65
+ ".xlf",
66
+ ".xliff",
67
+ ".xpdl",
68
+ ".xul",
69
+ ".xoml",
70
+ ".vsixmanifest"
71
+ ],
72
+ "tokenize": "src/tokenizeXml.js"
73
+ }
74
+ ]
75
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @enum number
3
+ */
4
+ export const TokenType = {
5
+ Text: 0,
6
+ NewLine: 1,
7
+ }
8
+
9
+ export const TokenMap = {
10
+ [TokenType.Text]: 'Text',
11
+ }
12
+
13
+ export const initialLineState = {
14
+ state: 1,
15
+ }
16
+
17
+ export const tokenizeLine = (line, lineState) => {
18
+ if (line.length === 0) {
19
+ return {
20
+ state: 1,
21
+ tokens: [],
22
+ }
23
+ }
24
+ return {
25
+ state: 1,
26
+ tokens: [
27
+ {
28
+ type: TokenType.Text,
29
+ length: line.length,
30
+ },
31
+ ],
32
+ }
33
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/shared-process",
3
- "version": "0.0.36",
3
+ "version": "0.0.37",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -38,8 +38,8 @@
38
38
  "verror": "^1.10.1",
39
39
  "ws": "^8.8.1",
40
40
  "xdg-basedir": "^5.1.0",
41
- "@lvce-editor/pty-host": "0.0.36",
42
- "@lvce-editor/extension-host": "0.0.36"
41
+ "@lvce-editor/pty-host": "0.0.37",
42
+ "@lvce-editor/extension-host": "0.0.37"
43
43
  },
44
44
  "optionalDependencies": {
45
45
  "electron-clipboard-ex": "^1.3.3",
@@ -17,16 +17,35 @@ const isLanguageBasics = (extension) => {
17
17
  return false
18
18
  }
19
19
 
20
+ const getEnabledExtensionWithOnlyExtension = (
21
+ builtinExtensions,
22
+ onlyExtension
23
+ ) => {
24
+ const extensions = []
25
+ for (const builtinExtension of builtinExtensions) {
26
+ if (builtinExtension.id === onlyExtension.id) {
27
+ continue
28
+ }
29
+ extensions.push(builtinExtension)
30
+ }
31
+ extensions.push(onlyExtension)
32
+ return extensions
33
+ }
34
+
20
35
  export const state = {
21
36
  async getExtensions() {
22
37
  // TODO only read from env once
23
38
  const builtinExtensions = await getBuiltinExtensions()
24
- if (process.env.ONLY_EXTENSION) {
25
- const absolutePath = path.resolve(process.env.ONLY_EXTENSION)
26
- const onlyExtension = await getExtensionManifests([absolutePath])
27
- return [...builtinExtensions.filter(isLanguageBasics), ...onlyExtension]
39
+ const onlyExtensionPath = Platform.getOnlyExtensionPath()
40
+ if (onlyExtensionPath) {
41
+ const absolutePath = path.resolve(onlyExtensionPath)
42
+ const [onlyExtension] = await getExtensionManifests([absolutePath])
43
+ const enabledExtensions = getEnabledExtensionWithOnlyExtension(
44
+ builtinExtensions,
45
+ onlyExtension
46
+ )
47
+ return enabledExtensions
28
48
  }
29
-
30
49
  const installedExtensions = await getInstalledExtensions()
31
50
  return [...builtinExtensions, ...installedExtensions]
32
51
  },
@@ -138,3 +138,7 @@ export const getNodePath = () => {
138
138
  export const getTmpDir = () => {
139
139
  return tmpdir()
140
140
  }
141
+
142
+ export const getOnlyExtensionPath = () => {
143
+ return process.env.ONLY_EXTENSION
144
+ }