npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

foam-language-server

v0.3.3

Published

A language server implementation for OpenFOAM file format.

Downloads

102

Readme

FOAM Language Server

This project is young; still at early phases of development, so expect things to change considerably

DISCLAIMER: This offering is not approved or endorsed by OpenCFD Limited, producer and distributor of the OpenFOAM software and owner of the OPENFOAM® and OpenCFD® trade marks.

An implementation of the Language Server Protocol (LSP) for OpenFOAM dictionaries.

Here is a quick demo of the most important features:

foam lsp demo

For a more detailed explanation, check this slide out.

We're supporting the following features (* for partial or limited support):

  • Auto-Completion [Not fully implemented Yet]
    • [x] Macro expansion * (always suggests absolute paths)
    • [x] Common keywords *
    • [x] Snippets (with documentation) *
    • [ ] Valid entries based on the "Banana Trick" ?
  • Document symbols [Complete]
    • [x] Uses the Tree-Sitter grammar for OpenFOAM
    • [x] Can penetrate lists and peek inside
    • [x] Workspace-wide symbols
  • Jump to Definition [Complete, works on a single file]
    • [x] Macro expansion of absolute paths
    • [x] Macro expansion of dictionary-relative paths
  • Hover Documentation [Complete, but lacks actual keywords docs]
    • [x] Common keywords *
  • Signature Help [Complete, but lacks docs for signature help]
    • [x] Common keywords *
  • Diagnostics [Not fully implemented Yet,]
    • [x] Can handle most default FATAL ERRORs and FATAL IO ERRORs
    • [x] Needs to run the solver, so you'll get one error at a time
    • [x] Workspace-wide
    • [ ] Support for warnings
    • [ ] Custom error regular expressions

The following common LSP features will not be considered in the near future (and PRs to these areas are actually discourages):

  • Syntax-based Folding and Highlighting
    • Because tree-sitter-foam has these features already.
    • All you have to do is :TSInstall foam (on (Neo)VIM, or equivalent)
  • Formatting
    • Please use external C++/Typescript formatters if you're obsessed with nice-looking code.
  • Semantic Tokenisation
    • We have little to no semantics in OpenFOAM file format. Especially, the lack of modifier-like constructs discourages extensive semantics tokenisation. Node types from the Tree-Sitter grammar are enough.

Installation and configuration

Installation

If you want the (somewhat) stable code (from Releases):

npm install foam-language-server

If you want the bleeding-edge features, with all the bleeding-edge bugs:

git clone --depth 1 --single-branch -b develop https://github.com/FoamScience/foam-language-server
npm install
npm test

Configuration

Root directory detection

It's important that your text editor detects the case directory as the "root directory" because diagnostics will depend on it. Most editors will ask the LSP for the root directory, but for those which don't, you'll have to configure it manually.

LSP configuration

[TODO: Section not complete]

Take a look at the return value of connection.onInitialization in server/foam-ls.ts for an up-to-date list of capabilities.

FAQ

Not a (Neo)VIM user?

can I ask WHY?

It is possible to run this LSP implementation with any text editor or IDE which supports LSP (most do), however Neo(VIM) has a clear priority and you may have to give up some features for things to work on other editors.

Can I run it on Windows?

Sure, you can. It's basically a piece of C++/JavaScript technology which has nothing to do with OpenFOAM code base (other than parsing its file format, of course).

Currently the only feature which has a slim chance of working on Windows is the "diagnostics" feature, because it needs to fire the case's solver to see if it errors out (and captures stderr).

If you have solvers on your Windows PATH, and diagnostics are not showing up; please file a bug report.

Contributing to this project

Please skim through CONTRIBUTING.md if you plan to join on the fun.