Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lox showcase (Fixed Commits) #197

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open

Lox showcase (Fixed Commits) #197

wants to merge 14 commits into from

Conversation

emilkrebs
Copy link
Contributor

image
image

Two steps are needed first in order to publish this

  1. Modified the language server so it sends the results of the interpreter TypeFox/langium-lox#3 is needed first and has to be published on npm
  2. Add the package to the dependencies

@emilkrebs
Copy link
Contributor Author

Needed to create a new branch to fix the Eclipse ECA. So here is the new PR.

@kaisalmen
Copy link
Contributor

@emilkrebs just a heads up. You need to rebase this once #196 is merged. But adjusting will not be hard.

Emil Krebs and others added 12 commits October 18, 2023 16:16
* Fix typo in getting-started grammar

* Make code blocks vertically scrollable
To make it possible to read the docs on a phone
* update of langium + monaco tutorial

* update generation in the web tutorial
* Update to latest monaco-editor-wrapper and monaco-editor-react
* Implemented review comments
* fixed nested elements and scaling

* remaned one function

* fixed a renaming problem

* Fix typo in getting-started grammar (#198)

* Fix typo in getting-started grammar

* Make code blocks vertically scrollable
To make it possible to read the docs on a phone

* Update Langium + Monaco Tutorials (#192)

* update of langium + monaco tutorial

* update generation in the web tutorial

* Update to latest monaco-editor-wrapper and monaco-editor-react (#196)

* Update to latest monaco-editor-wrapper and monaco-editor-react
* Implemented review comments

* fixed a renaming problem

---------

Co-authored-by: Vit Gottwald <vit.gottwald@gmail.com>
Co-authored-by: Benjamin Friedman Wilson <benjamin.wilson@typefox.io>
Co-authored-by: Kai Salmen <kai.salmen@typefox.io>
// get the size of the tree
const getChildSize = (child: TreeNode): number => {
// get the leaf nodes of the tree
const getLeafNodes = (child: TreeNode): number => {
Copy link
Contributor

@Lotes Lotes Dec 13, 2023

Choose a reason for hiding this comment

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

getLeafCount, right?! It is returning a number.

return 1 + Math.max(...child.children.map(getLongestPath));
};

const height = getLeafNodes(data) * 60;
Copy link
Contributor

Choose a reason for hiding this comment

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

A minor thing: You use magic numbers. Maybe give them a name. Especially when one number relates to the amount of another number. I guess these numbers relate to the max label size of the nodes or?
If there is no relation between these numbers and they are unique as they are used here, I think you can skip this comment of mine.

It is about code quality. Those hidden relationships can cost time for the next guy working on this file.

}

// create a TreeNode from any DomainModelElement
const getTreeNode = (e: DomainModelElement): TreeNode => {
Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove the comment by giving proper names for getTreeNode. Just name it getDomainModelTreeNode. Same for the comments above. If the comment gives no extra information to the next line, it is basically useless and a danger of becoming outdated when the code changes again.
Comments are good for stuff that is not written in code (like motivations or hidden knowledge).

@Lotes
Copy link
Contributor

Lotes commented Dec 13, 2023

For me the website does not build. There is a problem with build:worker/lox.

> build:worker/lox
> esbuild ../node_modules/langium-lox/out/language-server/main-browser.js --bundle --format=iife --outfile=./static/showcase/libs/worker/loxServerWorker.js

✘ [ERROR] Could not resolve "../node_modules/langium-lox/out/language-server/main-browser.js"

Please make it also work for local environment, because I have no access using Gitpod.

I guess we miss an entry in the package.json for dev dependency langium-lox, or?!

Ah, I saw the description of you, sorry!

@spoenemann
Copy link
Contributor

Please rebase on the latest main branch to support PR previews (#210).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants