Skip to content

Commit

Permalink
Merge pull request #505 from googlefonts/merge-fea-rs
Browse files Browse the repository at this point in the history
Merge fea-rs repo
  • Loading branch information
cmyr authored Oct 25, 2023
2 parents dcd0839 + e303f72 commit cb9722c
Show file tree
Hide file tree
Showing 555 changed files with 56,709 additions and 0 deletions.
111 changes: 111 additions & 0 deletions .github/workflows/fea-rs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
on:
pull_request:
push:
branches:
- main
tags:
- "*"

name: Continuous integration

jobs:
check:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- run: rustup component add rustfmt

- name: rustfmt check
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: cargo doc
uses: actions-rs/cargo@v1
with:
command: doc
args: --all-features --document-private-items

clippy-lint:
name: Clippy lints
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: clippy
profile: minimal
override: true

- name: cargo clippy --all-features
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features --all-targets -- -D warnings

- name: cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --no-default-features -- -D warnings

test-all-targets:
name: cargo test all-targets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: getsentry/[email protected]
id: venv
with:
python-version: 3.10.7
requirement-files: requirements.txt
- run: pip install -r requirements.txt
if: steps.venv.outputs.cache-hit != 'true'

- name: install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: cargo test all-targets
uses: actions-rs/cargo@v1
with:
command: test
args: --all-targets --all-features


test-basic:
name: cargo test basic
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: getsentry/[email protected]
id: venv
with:
python-version: 3.10.7
requirement-files: requirements.txt
- run: pip install -r requirements.txt
if: steps.venv.outputs.cache-hit != 'true'

- name: install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true

- name: cargo test basic
uses: actions-rs/cargo@v1
with:
command: test

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ Cargo.lock
.venv/

.DS_Store

Empty file added .gitmodules
Empty file.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,6 @@ members = [
"glyphs2fontir",
"ufo2fontir",
"fontc",
"fea-rs",
"fea-lsp",
]
17 changes: 17 additions & 0 deletions fea-lsp/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "fea-lsp"
version = "0.1.0"
edition = "2018"
publish = false

[dependencies]
fea-rs = {version = "0", path = "../fea-rs"}
lspower = "1.1.0"
tokio = { version = "1.3", features = ["io-std", "io-util", "macros", "net", "rt-multi-thread", "sync", "time"] }
serde_json = "1.0"
anyhow = "1.0"
env_logger = "0.10"

# cargo-release settings
[package.metadata.release]
release = false
8 changes: 8 additions & 0 deletions fea-lsp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# FEA Language Server

This crate is an experimental [language server][] for Adobe OpenType Feature
files.

It is an experiment, and not supported or intended for use.

[language server]: https://microsoft.github.io/language-server-protocol/
5 changes: 5 additions & 0 deletions fea-lsp/editors/vscode/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/**
client/node_modules/**
client/out/**
server/node_modules/**
server/out/**
20 changes: 20 additions & 0 deletions fea-lsp/editors/vscode/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**@type {import('eslint').Linter.Config} */
// eslint-disable-next-line no-undef
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
plugins: [
'@typescript-eslint',
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
],
rules: {
'semi': [2, "always"],
'@typescript-eslint/no-unused-vars': 0,
'@typescript-eslint/no-explicit-any': 0,
'@typescript-eslint/explicit-module-boundary-types': 0,
'@typescript-eslint/no-non-null-assertion': 0,
}
};
4 changes: 4 additions & 0 deletions fea-lsp/editors/vscode/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
out
node_modules
client/server
.vscode-test
9 changes: 9 additions & 0 deletions fea-lsp/editors/vscode/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp

// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"dbaeumer.vscode-eslint"
]
}
44 changes: 44 additions & 0 deletions fea-lsp/editors/vscode/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// A launch configuration that compiles the extension and then opens it inside a new window
{
"version": "0.2.0",
"configurations": [
{
"type": "extensionHost",
"request": "launch",
"name": "Launch Client",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}"],
"outFiles": ["${workspaceRoot}/client/out/**/*.js"],
"preLaunchTask": {
"type": "npm",
"script": "watch"
}
},
{
"type": "node",
"request": "attach",
"name": "Attach to Server",
"port": 6009,
"restart": true,
"outFiles": ["${workspaceRoot}/server/out/**/*.js"]
},
{
"name": "Language Server E2E Test",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}",
"--extensionTestsPath=${workspaceRoot}/client/out/test/index",
"${workspaceRoot}/client/testFixture"
],
"outFiles": ["${workspaceRoot}/client/out/test/**/*.js"]
}
],
"compounds": [
{
"name": "Client + Server",
"configurations": ["Launch Client", "Attach to Server"]
}
]
}
8 changes: 8 additions & 0 deletions fea-lsp/editors/vscode/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"editor.insertSpaces": false,
"typescript.tsc.autoDetect": "off",
"typescript.preferences.quoteStyle": "single",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
}
33 changes: 33 additions & 0 deletions fea-lsp/editors/vscode/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "compile",
"group": "build",
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": [
"$tsc"
]
},
{
"type": "npm",
"script": "watch",
"isBackground": true,
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": [
"$tsc-watch"
]
}
]
}
15 changes: 15 additions & 0 deletions fea-lsp/editors/vscode/.vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.vscode/**
**/*.ts
**/*.map
.gitignore
**/tsconfig.json
**/tsconfig.base.json
contributing.md
.travis.yml
client/node_modules/**
!client/node_modules/vscode-jsonrpc/**
!client/node_modules/vscode-languageclient/**
!client/node_modules/vscode-languageserver-protocol/**
!client/node_modules/vscode-languageserver-types/**
!client/node_modules/{minimatch,brace-expansion,concat-map,balanced-match}/**
!client/node_modules/{semver,lru-cache,yallist}/**
26 changes: 26 additions & 0 deletions fea-lsp/editors/vscode/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# VSCode Extension

This is very hacky and probably not a great experience right now; it was
intended as a proof of concept. Use at your peril.


Installation:

this extension is not published, and has to be run manually. First, you will
need to compile the `fea-lsp` crate in the parent directory, and move the
binary somewhere where you can easily find it, such as `~/.fea-lsp/fea-lsp`.

Then from from this directory, run:

```sh
npm install
npm run compile
```

Open this directory in VSCode. From the 'run and debug' sidebar, run the 'Launch
Client' command. This will open a new VSCode window with the extenstion enabled.

To actually make it work, you need to point it the location of the `fea-lsp`
binary you compiled earlier. Open VSCode settings, and search for 'fea'. At the
bottom you should find a setting "fea-lsp > Server: Path", where you can enter
the path to the binary.
29 changes: 29 additions & 0 deletions fea-lsp/editors/vscode/language-configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"comments": {
// symbol used for single line comment. Remove this entry if your language does not support line comments
"lineComment": "#"
},
// symbols used as brackets
"brackets": [
["{", "}"],
["[", "]"],
["(", ")"],
["<", ">"]
],
// symbols that are auto closed when typing
"autoClosingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["\"", "\""]
],
// symbols that can be used to surround a selection
"surroundingPairs": [
["{", "}"],
["[", "]"],
["(", ")"],
["<", ">"],
["\"", "\""]
]
}

Loading

0 comments on commit cb9722c

Please sign in to comment.