Organizational repo for Mission Pinball. Holds the discussions, the overall readme docs, etc.
missionpinball / mpf-ls Goto Github PK
View Code? Open in Web Editor NEWMission Pinball Framework Language Server
Mission Pinball Framework Language Server
Following the readme I've installed using
pip3 install mpf-language-server
which gets me version 0.54.2 which still has errors for standalone show files:
Internal error while verifying: 'int' object has no attribute 'split' Traceback (most recent call last):
File "c:\users\matt\mpfenv\lib\site-packages\mpfls\mpf_ls.py", line 1267, in lint
diagnostics = self._walk_diagnostics_root(document, document.config_roundtrip)
File "c:\users\matt\mpfenv\lib\site-packages\mpfls\mpf_ls.py", line 975, in _walk_diagnostics_root
root_spec = self._get_spec(key)
File "c:\users\matt\mpfenv\lib\site-packages\mpfls\mpf_ls.py", line 1077, in _get_spec
spec_names = spec_name_str.split(",")
AttributeError: 'int' object has no attribute 'split'
mpf-ls(998)
I installed the dev branch using
pip3 install git+https://github.com/missionpinball/mpf-ls.git@dev
so pip3 list
now shows the version as mpf-language-server 0.55.0.dev1+8.g4d9055d
and the code matches.
I've realised as I've worked through this that the dev branch just hasn't been released in a while, and standalone show files are still broken. I'll leave this here for people who want to know how to get the latest and raise another issue.
Hi,
I have this section in my config
lights: led_strip_0_led_1: number: 0-0-1 subtype: led type: rgb tags: group1 led_strip_0_led_2: number: 0-0-2 subtype: led type: rgb tags: group1 led_strip_0_led_3: previous: led_strip_0_led_2 #this line shows as error subtype: led type: rgb tags: group1
The marked line shows
Could not find led_strip_0_led_2 of type lights.mpf-ls(13)
The light is defined a few lines above, so I would consider this being a bug. The solution is: the file above was a lights_config.yaml but it was not referenced in yaml.conf. So essentially it was never being used anyways. For a syntax check it doesn't make sense to have such a behavior. As soon as I reference the lights file in my main config the error is gone. There are no lights defined in the main config file.
Maybe that can be fixed in a future version. Thanks.
This file:
https://github.com/missionpinball/mpf-ls/blob/dev/mpfls/workspace.py
References this file:
https://github.com/missionpinball/mpf/blob/0.56.x/mpf/file_interfaces/yaml_roundtrip.py
Which was removed as of 0.57.
Also, the readme install should probably have "pip install mpf-language-server" as the example install command, since all of the MPF docs have been switched back to using pip and not pipx, and also running LS in a venv comes with other issues like vscode not being able to find it, so probably best to install globally (at least for novice users following default instructions).
The README do not cover that case.
Solution that worked for me:
I you run mpf in Python Virtual Environment (venv) then mpfls also has to be run in that venv.
For example create a script that activate venv and run mpfls and add that script as Executable
for yaml
in
"Settings -> Languages & Frameworks -> Language Server Protocol -> Server Definitions".
I created a PR to enhance the doc. #13
Hi,
I am having trouble getting the mpfls to run. I am able to run mpf in my machine folder, but not outside of it, not sure if that matters and is a prerequisite. I saw in the video tutorial that I should be able to run mpfls after installation, when I run mpfls (regardless in what folder) I get
mpfls
Traceback (most recent call last):
File "/home/dev-user/.local/bin/mpfls", line 11, in <module>
load_entry_point('mpf-language-server==0.54.2', 'console_scripts', 'mpfls')()
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2852, in load_entry_point
return ep.load()
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2443, in load
return self.resolve()
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 2449, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/home/dev-user/.local/lib/python3.9/site-packages/mpfls/__main__.py", line 7, in <module>
from .mpf_ls import start_io_lang_server, start_tcp_lang_server, MPFLanguageServer
File "/home/dev-user/.local/lib/python3.9/site-packages/mpfls/mpf_ls.py", line 12, in <module>
from mpf.core.config_processor import ConfigProcessor
ModuleNotFoundError: No module named 'mpf'
What else as a prerequisite do I need?
mpf is
mpf --version
MPF v0.56.0-dev33
Again not sure if it matters, I have multiple versions of python on my box, so I need to run python3.9 and pip3.9 as command and not python3 or pip3.
Thanks!
installed dev branch using:
pip3 install git+https://github.com/missionpinball/mpf-ls.git@dev
now have this version:
mpf-language-server 0.55.0.dev1+8.g4d9055d
standalone shows are causing this error:
Internal error while verifying: Failed to split 0 Traceback (most recent call last):
File "c:\users\matt\mpfenv\lib\site-packages\mpfls\mpf_ls.py", line 1148, in _get_spec
spec_names = spec_name_str.split(",")
AttributeError: 'int' object has no attribute 'split'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:\users\matt\mpfenv\lib\site-packages\mpfls\mpf_ls.py", line 1355, in lint_internal
diagnostics = self._walk_diagnostics_root(document, document.config_roundtrip)
File "c:\users\matt\mpfenv\lib\site-packages\mpfls\mpf_ls.py", line 1045, in _walk_diagnostics_root
root_spec = self._get_spec(key)
File "c:\users\matt\mpfenv\lib\site-packages\mpfls\mpf_ls.py", line 1150, in _get_spec
raise AssertionError("Failed to split {}".format(spec_name_str)) from e
AssertionError: Failed to split 0
mpf-ls(998)
Using the built in extensions in VScode and after installation, when enabling the extension an error message occurs :
[Error - 23:41:06] Starting client failed
Launching server using command mpfls failed.
I have tried multiple things already, all my versions are up to date, the extension simply doesn't load.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.