Skip to content

Commit

Permalink
🔖 Alpha release 0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
kenkangxgwe committed Jun 8, 2019
2 parents 1a17e72 + d1ee30d commit 43ecb49
Show file tree
Hide file tree
Showing 24 changed files with 758 additions and 5,870 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.2] - 2019-05-15

### Added

- Named pipe support for Windows

### Fixed

- Avoid early evaluation that slow down the initialization

- Markdown conversion for special characters

### Removed

- SVG image for document information

## [0.1.1] - 2019-02-05 🧧

### Added
Expand Down
47 changes: 24 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
[![Develop with: Wolfram Language](https://img.shields.io/badge/Develop%20with-Wolfram%20Language-%23d81013.svg)](http://www.wolfram.com/language/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

![WolframLanguageServerLogo](https://raw.githubusercontent.com/kenkangxgwe/lsp-wl/master/images/wolfram-language-server-logo-clipped.png)
> by [kenkangxgwe](mailto:kenkangxgwe@gmail.com) and [hxianglong](https://github.com/huxianglong)
![WolframLanguageServerLogo](images/wolfram-language-server-logo-clipped.png)
> by [kenkangxgwe](https://github.com/kenkangxgwe) and [hxianglong](https://github.com/huxianglong)
<!-- markdown-toc start - Don't edit this section. Run M-x markdown-toc-refresh-toc -->
**Table of Contents**

- [Wolfram Language Server](#wolfram-language-server)
- [Installation](#installation)
- [Run the Server](#run-the-server)
- [Features](#features)
- [Contribute](#contribute)
- [Design Principles](#design-principles)
- [Todo list](#todo-list)
- [Donations :dollar:](#donations-dollar)
- [Footnotes](#footnotes)
- [Installation](#installation)
- [Run the Server](#run-the-server)
- [Features](#features)
- [Contribute](#contribute)
- [Design Principles](#design-principles)
- [Todo list](#todo-list)
- [Donations :dollar:](#donations-dollar)
- [Footnotes](#footnotes)

<!-- markdown-toc end -->

Expand All @@ -30,19 +30,19 @@ implemented in Wolfram Language itself.
Our current goal is to provide the experience as good as the Mathematica FrontEnd
with addition power from the editor.

We have provided the client-side code for VS Code in this repo, which is based on some slight
We have provided the client-side code for VS Code [here](https://github.com/kenkangxgwe/vscode-lsp-wl), which is based on some slight
modifications of [Microsoft's LSP
example](https://github.com/Microsoft/vscode-extension-samples/tree/master/lsp-sample).
If you are using other tools supporting LSP, some slight modifications to the
client would certainly work too.

## Installation

0. [Wolfram Mathematica](http://www.wolfram.com/mathematica/) (11.2 or
higher<a name="ref1"></a>[<sup>1</sup>](#footnote1)).
0. [Wolfram Mathematica](http://www.wolfram.com/mathematica/) (11.2 or higher<a
name="ref1"></a>[<sup>1</sup>](#footnote1)) or [Wolfram
Engine](https://www.wolfram.com/engine/) (12.0 or higher).

1. Download the [server](https://github.com/kenkangxgwe/lsp-wl) from its
repository.
1. Use git to clone this repository.

``` sh
git clone https://github.com/kenkangxgwe/lsp-wl.git
Expand All @@ -65,9 +65,11 @@ wolframscript -f /path/to/lsp-wl/init.wls [args]
The posible arguments for the server are

- `--help, -h` to print help information.
- `--socket=port` to assign the port that the server connect to. (Default:
`6536`)
Socket is the only channel that we currently support.
- `--socket=port` to assign the port to which the server will connect. (Default:
`6536`)
- `--tcp-server=port` to assign the port at which the server will start. (Default:
`6536`)
- `--pipe=pipename` to specify the pipe name for the server to connect to.
- `--log=level, -l level` to specify the logging level of the server.
(Levels: `error`, `warn`, `info`, `debug`. Default: `info`)
- `--test, -t` to run the unit test for the server.
Expand All @@ -89,20 +91,20 @@ This is a good way to see the results from the unit tests.
- *Hover:* Provide definitions for Wolfram functions and system variables, such
as `String` and `$Path`.

![hover](https://raw.githubusercontent.com/kenkangxgwe/lsp-wl/develop/images/hover.png)
![hover](images/hover.png)

- *Completion:* The completion is triggered by the client automatically.
Currently, Wolfram functions and system variables would be displayed.

- *Completion Resolve:* Further information would be provided for the items in
the list.

![completion](https://raw.githubusercontent.com/kenkangxgwe/lsp-wl/develop/images/completion.png)
![completion](images/completion.png)

- *Diagnostics:* Syntax error would be underlined. However, the specific syntax
error is not supported at the moment.

![diagnostics](https://raw.githubusercontent.com/kenkangxgwe/lsp-wl/develop/images/diagnostics.png)
![diagnostics](images/diagnostics.png)

This is an early release, so more features are on the way. Syntax highlight is
NOT supported according to the design of LSP, but there are already some good
Expand Down Expand Up @@ -160,8 +162,7 @@ thanks in advance :smile:.

- Paypal: [email protected]
- Alipay (With QRCode): 13916018006
![Alipay
QRCode](https://raw.githubusercontent.com/kenkangxgwe/lsp-wl/master/images/alipay.jpg)
![Alipay QRCode](images/alipay.jpg)

## Footnotes

Expand Down
19 changes: 14 additions & 5 deletions WolframLanguageServer/DataType.wl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ ClearAll[Evaluate[Context[] <> "*"]];
DeclareType::usage = "DeclareType[typename, <|key_String -> pattern...|>] declares a type given by its name and an association indicating every field and its pattern in the type. \
typename[key] gets access to the corresponding value. \
typename[key, default] gets access to the corresponding value. If it is missing, returns the default.";
ConstructType::usage = "ConstructType[params_Association, type] constructs an object of the given type with specified params."
TypeUsage::usage = "TypeUsage[type, usage_String] append usage to current type."
Keys::usage = Keys::usage <> "\nKeys[typename] gives a list of the keys field_i in type typename.";
KeyPatterns::usage = "KeyPatterns[typename] returns the key-pattern pair of the type.";
ReplaceKey::usage = "ReplaceKey[object, key -> value] assigns the value to key in given object.
Expand Down Expand Up @@ -70,6 +72,10 @@ DeclareType[typename_Symbol, typekey:<|(_String -> _)...|>] := Module[
];


Begin["`Private`"]
ClearAll[Evaluate[Context[] <> "*"]]


(* ::Section:: *)
(*Default Constructor*)

Expand All @@ -90,32 +96,32 @@ ConstructTypeAlternatives[parameters_, {{}, res_}] := res;
ConstructTypeAlternatives[parameters_, {{p_, ps___}, res_}] := ConstructTypeAlternatives[parameters,
ConstructType[parameters, p]
// Replace[{
_Missing -> {{ps}, res},
_Missing :> {{ps}, res},
newres_ :> {{}, newres}
}]
];

ConstructType[parameters_List, pattern:List[(Verbatim[Repeated]|Verbatim[RepeatedNull])[p_]]] := (
ConstructTypeList[p, {parameters, {}}] // Replace[_Missing -> Missing["ConstructorNotFound", {parameters, pattern}]]
ConstructTypeList[p, {parameters, {}}] // Replace[_Missing :> Missing["ConstructorNotFound", {parameters, pattern}]]
);

ConstructType[parameters_List, pattern:List[(Verbatim[BlankSequence]|Verbatim[BlankNullSequence])[p_]]] := (
ConstructTypeList[_p, {parameters, {}}] // Replace[_Missing -> Missing["ConstructorNotFound", {parameters, pattern}]]
ConstructTypeList[_p, {parameters, {}}] // Replace[_Missing :> Missing["ConstructorNotFound", {parameters, pattern}]]
);

ConstructTypeList[p_, {{}, res_}] := res;
ConstructTypeList[p_, {{param_, params___}, res_}] := ConstructTypeList[p,
ConstructType[param, p]
// Replace[{
_Missing -> {{}, MissingQ["ConstructorNotFound"]},
_Missing :> {{}, MissingQ["ConstructorNotFound"]},
curRes_ :> {{params}, Append[res, curRes]}
}]
];

ConstructType[parameters_Association, pattern:Association[(Verbatim[Repeated]|Verbatim[RepeatedNull])[Rule[key_, val_]]]] := (
ConstructType[Keys[parameters], {key...}]
// Replace[{
_Missing -> Missing["ConstructorNotFound", {parameters, pattern}],
_Missing :> Missing["ConstructorNotFound", {parameters, pattern}],
res1_ :> (
ConstructType[Values[parameters], {val...}]
// Replace[{
Expand Down Expand Up @@ -196,4 +202,7 @@ TypeUsage[typename_Symbol, usage_String] := (
);


End[]


EndPackage[];
Loading

0 comments on commit 43ecb49

Please sign in to comment.