GithubHelp home page GithubHelp logo

zzzz465 / rwxml-language-server Goto Github PK

View Code? Open in Web Editor NEW
13.0 2.0 3.0 137.28 MB

autocomplete and debug your RimWorld XML

Home Page: https://github.com/zzzz465/rwxml-language-server

JavaScript 2.67% TypeScript 90.02% C# 7.31%
csharp rimworld xml-modding vscode-extension lsp-server typescript

rwxml-language-server's Introduction

RWXML Language Server

provides various IDE functionalities, as VSCode Extension

Install (if you're using vscode first time?)

Check how-to

FAQ

Check FAQ

features

  • Custom syntax highlighting
  • Basic completion snippets.
  • Real time code analysis.
  • Code Completion.
  • Go to definition, Go to Reference support.
  • Find all symbol references.
  • find parent / childrenss
  • Symbol rename command.
  • Inheritance Attribute suggestion
  • AlienRace support
  • incremental update & validation
  • Texture preview
  • Texture path suggestion
  • patch operation snippets
  • Cache DLL extracted data

Commands

RWXML: Clear DLL Cache

deletes all DLL extracted cache.

RWXML: Open Cache Directory

opens your cache directory.

Install

VSCode Marketplace (Click)

Configuration

configures RWXML Language Server.

{
  "rwxml.paths.rimWorld": "C:\\...\\common\\RimWorld", // RimWorld/ Directory path.

  // overrides default path / assumed path from rimWorld
  "rwxml.paths.rimWorldData": "C:\\...\\RimWorld\\Data",
  "rwxml.paths.rimWorldManaged": "C:\\...\\RimWorld\\RimWorldWin64_Data\\Managed",
  "rwxml.paths.localMods": "C:\\...\\RimWorld\\Mods",
  "rwxml.paths.workshopMods": "C:\\...\\workshop\\contents\\294100",
  "rwxml.paths.externalMods": [
    "<other-mods-directory-1>",
    "<other-mods-directory-2>",
    // and so on...
  ],

  
  "rwxml.logs.level": "info", // set log level, "info", "warn", "error", "debug", "silly"

  "rwxml.codeHighlighting.enabled": true, // manages code highlighting. fine-grained control is not implemented yet
  
  "rwxml.diagnostics.enabled": true, // manages code diagnostics.
}

Default Paths

this extension requires RimWorld DLL, RimWorld Core to operate. it scans Workshop/Local Mod Directory to support external mods.

the path for these resources are below:

RimWorld DLL

  • windows: C:\Program files (x86)\Steam\steamapps\common\rimworld\RimWorldWin64_Data\Managed
  • darwin(macos): Library/Application Support/Steam/steamapps/common/RimWorld/RimWorldMac.app/Contents/Resources/Data/Managed

RimWorld Core

  • windows: C:\\Program Files (x86)\\Steam\\steamapps\\common\\RimWorld\\Data
  • darwin(macos): Library/Application Support/Steam/Steamapps/common/RimWorld/RimWorldMac.app/Data

Local Mod Directory

  • windows: C:\\Program Files (x86)\\Steam\\steamapps\\common\\RimWorld\\Mods
  • darwin(macos): Library/Application Support/Steam/Steamapps/common/RimWorld/RimWorldMac.app/Mods

Workshop Directory

  • windows: C:\\Program Files (x86)\\Steam\\steamapps\\workshop\\content\\294100
  • darwin(macos): Library/Application Support/Steam/Steamapps/workshop/content/294100

Setup devlopment environment

  1. clone repository locally
#!/bin/bash
git clone https://github.com/zzzz465/rwxml-language-server
  1. install project
#!/bin/bash
# cwd: repository root
pnpm install
  1. build project
#!/bin/bash
# cwd: repository root
pnpm run watch # this will build project and watch project changes
  1. open /vsc-extension with VSCode, and launch Launch Client

rwxml-language-server's People

Contributors

wolfsblvt avatar zzzz465 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rwxml-language-server's Issues

Extension load error "cannot find type Def in typeInfoMap"

Hey,
no matter what I'm trying, I can't seem to get your installation to work.

I already moved Rimworld to the default install path to prevent problems that I've read about here, I entered all paths in the extension settings manually.

Now when my newly created nearly empty mod folder, the extension doesn't load up. Extension Output log shows:

current log level: debug
hello world! initializing @rwxml-language-server/language-server ...
initialization completed!
[warn] [f] [default] cannot find type Def in typeInfoMap. something isn't right.
[info] [r] [default] [15982c8c-ac06-4486-a584-f4d8be084e59] reloading project... reason: project initialize
[info] [r] [default] [15982c8c-ac06-4486-a584-f4d8be084e59] loading project resources...
[info] [r] [default] [15982c8c-ac06-4486-a584-f4d8be084e59] clear project...
[info] [r] [default] [15982c8c-ac06-4486-a584-f4d8be084e59] project cleared.
[info] [r] [default] [15982c8c-ac06-4486-a584-f4d8be084e59] project evaluated.

The extension is enabled, but doesn't show any runtime info, like other extension would do when they are loaded:
image

This is a pretty fresh install of Visual Code.

I love the idea of your extensions, and would be really happy if I could get this to work.

EDIT: I also tried opening the Rimworld folder itself, and some workshop mod folders, always the same errors.
I tried to dive into the code to see which def it tried to load, but it got a bit confusing. Are you loading DLLs manually there to register type definitions?

No "Go to definition" (F12) jump on some references, eg ParentName tags

Creating it's own issue based on my observation in #119.

The ParentName tag does have a popup of the parent definition, but F12/Go to definition does not work there. Works in other popup/underlined places, like inside researchPrerequisites.

some nodes are not registered as linkable. it is not intended and needs to be fix.

Usage without a Rimworld install?

Hey, I really like this tool, it looks super useful and I can't wait to try it out. I was wondering though if you ever considered adding functionality for it without a Rimworld install present. That way someone could mod in a lightweight environment like GitHub Codespaces without needing to have Rimworld installed on the system they're modding on. Obviously it probably wouldn't be able to do reflection on modded defs and such, but it could probably at least support vanilla defs.

Feature Request: Support of xml patch files

I know this might ask for a lot, but I am just throwing this idea in.

A lot of modding is based on patching existing xml defs, either from vanilla things or other mods. You write all those complicated patch statements with inserted references, names etc.
How cool would it be if a few of the features provided with your extension would work there?

I've seen you have "patch operation snippets" already on your planned features list. But having similar highlighting to the normal defs inside patch statements would be amazing. Sometimes you add whole xml blocks similar to xml defs where you could jump to requirements, materials, etc. Lots of mods add full ThingDefs based on mod conditional checks or similar.
On the patch conditions you are often referencing names, types or classes, which could have a "Go to definition" jumper if they are known.

Some examples:
image
image
image
(and I guess a lot more I can't think of right now)

Don't know if this is feasible, as this sounds really difficult, based on the XML being less logically structured than normal defs, but still throwing in the idea here.

Codelens doesn't work on some references, eg abstract Thing definitions

Creating it's own issue based on my observation in #119.

My own abstract def has no quick info line above. Should show that it is referenced once. Checking other mods that work as well none of the abstract defs have that line above.
Go to references on the abstract def doesn't work

quick info is called "CodeLens". anyway, the reason why it's broken is a bit complex. there's two refernce types, 1. <defName>, 2. Name attribute. language server manages both types on resolving, but some features supports only one. that's why it doesn't pop up quick info.

you can see codelens code here as you can see, it checks <defName> value to determine whether to display codelens or not.

it is not a intended feature and needs to be fix.

How to set up 1.3 Insider version.

Hello! Thank you for making this tool. I found it very useful in the past.

I was hoping for a quick guide to setting up the new Insider version. I have installed it in VSCode but it does not seem to do anything. More specifically, it does not seem to recognize my custom def types or fields.
I understand that it no longer uses the config file (?)
Any help getting it to work would be appreciated.

I would like to help test and give feedback.
Thank you.

Codelens shows up multiple times for definitions in some files

Creating it's own issue based on my observation in #119.

image

I opened a few workshop mods that I downloaded to test the features of this extension, and to dive a bit deeper into some of their code.
For a few, the Codelens info on the definitions showed up four times, not the usual 1 time which I saw in most other places.
I guess this is not intended?

I can provide the link to the workshop mod from the screenshot: Door Mat
I can also post the files or more info if you need it.

show warning "same load file path will conflict"

image

림월드는 가상의 폴더에 파일을 로드하는데, 이 때 경로가 겹치는 파일이 있으면 merge 되지 않고, 대신 override 를 하게 됨.
따라서 한 쪽이 날라가는 일이 발생함

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.