renpy / vscode-language-renpy Goto Github PK
View Code? Open in Web Editor NEWRen'Py extension for Visual Studio Code
License: Other
Ren'Py extension for Visual Studio Code
License: Other
navigation.json
TODO
or FIXME
, etc.Notwithstanding the issue described in #27, store variables are not parsed correctly with underscores not being treated as valid characters in variable names.
In the case of this persistent variable, it's defined in another file, however it seems only the current file is checked for a default
statement on the persistent variable.
I'm unsure how to change it without a large change which may be rather performance intensive due to needing to look over all files in the workspace, but I am unfamiliar with the extensions api so there might be a better way to go about it than I know
The extension should support other Named Stores as defined in https://www.renpy.org/dev-doc/html/python.html#other-named-stores
Would anyone be interested in expanding the VS Code Ren'py language support extension into a fully programmatic Ren'py debugger with me? I am tired of not having go-to-definition, but I am fairly new to Ren'py.
References:
when enabled the spell check doesn't detect mistakes in rpy files.
awesome work by the way ^_^
New keywords and properties added in the 7.4 series are not supported.
For example, the blur ATL property is not colored correctly a transform:
transform chapter_transform:
alpha 1.0
blur None
linear 0.10 blur 10.0
"blur" should appear the same color as the "alpha" property.
For some features in games, users might need to change internal renpy behaviour somewhat
For example these two vars must both be set, however the extension treats the _window_subtitle
var as a new custom defined one rather than an existing one. A config to disable errors (or change them to warnings) for variables that are internal ones would be nice
(Basically so that _window_subtitle
or other similar internal vars could be given a warning that it's an internal renpy var)
Settings: "Renpy Warn On" radio button toggles (On or Off) don't take effect until manual file(s) close/load or via VSC restart
Possible VSC technical limitation but if not it would be fantastic if the settings took immediate effect OR otherwise the code calls to bring up the VSC reload request info box like some theme settings currently do:
Performance
languague-renpy
2.0.1
Windows_NT x64 10.0.19043
1.61.2
c:\Users\Stephen\AppData\Local\Temp\LuqueDaniel.languague-renpy-unresponsive.cpuprofile.txt
Find more details here: https://github.com/microsoft/vscode/wiki/Explain-extension-causes-high-cpu-load
The completion for 'at' (i.e., type 'show image at' and press space), the list of transforms is missing the Ren'Py-defined transforms such as center, left, right.
The pre-defined transforms are listed in the documentation:
https://www.renpy.org/doc/html/transforms.html
(They are also in the renpy.json dump file, but have no documentation.)
I've noticed this also happens on functions, but I've also seen that function highlighting is inconsistent.
Which is a function defined in another file but isn't recognized even after a compile via the extension. (This also applies to constants and variables defined in python blocks)
Also a small feature request, mainly the classes/functions are the issue as they can't be defaulted. As well would it be possible to provide semantic tokenization for func calls or class constructs? Would really help with readability.
Was wondering if there was any interest in adding something like other VSCode word counter extensions but specifically for Ren'Py scripts, since the more general ones count keywords, character names, etc., and Ren'Py linting only counts the project total (AFAIK). I'm willing to do it, but since I'm not personally familiar with TypeScript or extension development I wanna make sure it's feasible/desired before I start investing the time into it.
I do believe we need a code formatter in Renpy somehow
Dunno if it's in the scope of what this plugin is going for but an easy button to clear out old rpyc files since they're hidden by default would be nice. In bash its as simple as running find . -type f -name '*.rpyc' -delete
, which on one hand makes it kinda redundant but hey, why not?
The extension marks a name starting with two underscores as invalid
but Ren'Py only reserves names starting with a single underscore https://www.renpy.org/doc/html/reserved.html.
Adding to this, I've noticed self
isn't a keyword blue like it used to be. Instead, it's the same colour as normal variables
Originally posted by @multimokia in https://github.com/LuqueDaniel/vscode-language-renpy/issues/44#issuecomment-953514544
VSCodium has switched to Open VSX as their extension gallery.
Please consider publishing this extension to Open VSX following these steps.
Given the release of renpy 8 nightly, we now have python 3 at our disposal meaning some new syntaxes to take care of
#71 already covers type annotations, but there's also some more such as f-strings, among others.
Would love to see this supported
The warnOnInvalidVariableNames
option supports different levels (Error, Warning, and Disabled).
But a variable whose name is not valid should be an error. I think it doesn't make much sense that severity can be configured.
While this isn't recommended always, it's not worth flagging a whole script as an error.
Please add an option so that it won't function this way.
Reverting to 1.1.0 atm to work around this.
I'm not sure if this is an issue with the editor script or if it's a problem with Ren'Py itself, but it makes things a bit frustrating when working from the launcher.
Despite being sorted by position, the outline provider always categorizes and only orders inners by position. I think it'd be best to avoid categorizing entirely, as with other languages as well, no explicit categories are made, the icon alone is typically the distinction for type.
Additionally, the outline provider only uses a 0 range for all blocks:
This isn't ideal as it means breadcrumbs have no positional data to invorm the user where they are in the document. It also means the outline is unaware of where the user is in the file.
Functions which can properly block out portions of the file for formal outline providing and potential re-use in the discussed init block handling in #76 (a system to properly handle the starts/ends of blocks is needed) could be built to help.
Just installed the new update for the plugin and wanted to note an issue, not quite sure why it's happening though as the code looks right in how it provides them:
When trying to compile navigation data:
And refreshing navigation data:
Additionally my tests on #21, interestingly only seemed to run from the extension host window, but loading up a general rpy file does not seem to provide any highlighting or renpy info.
Especially for the repository linked on that PR, this would be amazing if it could be fixed!
Run lint and check code format.
Ren'Py supports the use of `...` for strings. This extension does not highlight text like this correctly as a string, however.
First of all, sorry for my bad terminology. That really isn't my forte. But now onto the issue
Steps to reproduce are pretty straight forward. All you need are two init python blocks and a class like so:
Now if you try to hide the class' content, second init statement gets hidden as well
Same thing happens if you use a function instead of a class.
The documentation recommends to bundle the extension. This reduces loading time and increases performance by minifying the source code.
Let's look into getting this setup. I have experience with webpack, but if esbuild is preferred that can be used.
Auto-Complete does not display for internal classes such as iap and updater.
Documentation hover is missing for iap as well as the pre-defined store variables such as _window_subtitle.
An error occurs due to a negative value in semantics.js:136:74
Suggested fix check, don't pass negative value to new vscode_1.Position() function:
line 136:
const context = i - 1 < 0 ? undefined : navigation_1.getCurrentContext(document, new vscode_1.Position(i - 1, indent_level));
Execption log message:
[2021-12-18 15:25:25.895] [exthost] [error] [LuqueDaniel.languague-renpy] provider FAILED
[2021-12-18 15:25:25.896] [exthost] [error] Error: Illegal argument: line must be non-negative
at P (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:5:1232)
at new p (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:86:17906)
at new p (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:86:17301)
at Object.getSemanticTokens (c:\Users\omega.vscode\extensions\luquedaniel.languague-renpy-2.0.4\out\semantics.js:136:74)
at Object.provideDocumentSemanticTokens (c:\Users\omega.vscode\extensions\luquedaniel.languague-renpy-2.0.4\out\extension.js:118:40)
at B.provideDocumentSemanticTokens (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:95:98728)
at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:95:120980
at We._withAdapter (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:95:111974)
at We.$provideDocumentSemanticTokens (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:95:120958)
at t._doInvokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:99:13802)
at t._invokeHandler (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:99:13486)
at t._receiveRequest (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:99:12097)
at t._receiveOneMessage (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:99:10826)
at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:99:8922
at u.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:66:1712)
at r.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:74:18942)
at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:114:34341
at u.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:66:1712)
at r.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:74:18942)
at n._receiveMessage (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:74:23523)
at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:74:21057
at u.fire (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:66:1712)
at w.acceptChunk (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:74:15770)
at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:74:14900
at Socket.T (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:114:13813)
at Socket.emit (events.js:315:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
at Socket.Readable.push (internal/streams/readable.js:223:10)
at Pipe.onStreamRead (internal/stream_base_commons.js:188:23)
Hi!
It appears that the autocompletion when typing scene
or with
is not showing the images in the images directory, not until I refresh VSCode. Then if I add/remove a file, the autocompletion remembers the completion before the modification.
Maybe I'm using it wrong. Let me know.
Thank you in advance!
There are some more files that should be hidden. Maybe the setting should be changed to 'excludeCompiledRenpyFilesFromWorkspace'.
As an example, along with .rpyc
there is .rpa
and .rpymc
.
We then might also want to exclude the cache
folder
Change the paragraph "Add syntax highlighting and snippets for Ren'Py to Visual Studio Code" to an updated explanation of the extension features.
Making a request to give expressions used in dialogue their own tm scope or semantic highlighing so they can be a consistent color.
Which uses the normal number colors and text color, which makes it a little awkward, especially when expression codes containing something like 1l
get highlighted as a number as well.
Looking at the scopes, expression codes are handled under source.renpy
, so they have no scope associated. Having them on their own scope which could provide custom highlighting -- or a point to change it via custom textmate rules -- would be super handy!
Am I correct in that this script is no longer needed since @renpytom has integrated it into the launcher already?
If that's the case I would suggest removing the file and the section in the readme
I've been using vscode-language-renpy exclusively when I edit Ren'Py, both as part of games and as part of the engine. It's the best tool for edting Ren'Py that I know of.
Is this extension mature enough to be installed automatically by Ren'Py? What I'm thinking is having Ren'Py automatically download vs code from the Microsoft servers, then tell code to install vscode-language-renpy, and then executing code to edit a project. If that makes sense, then I'd hope to add this is 7.5/8.0.
Hi there,
I recently upgraded from 1.1.0 to 2.0.5.
Overall it's way nicer, but I miss the ability to fold almost everything that was indented.
For reference, here is a picture from 1.1.0
and one from 2.0.5
In 2.0.5 I can only fold the label and nothing else in it.
I gave it a shot and dug through the code a little. As I understand it (keep in mind that I do not understand typescript or regex), the strings that the extension is using for folding are in the const rxFolding
variable. I changed it to this,
const rxFolding = /^\s*(screen|label|class|layeredimage|def|init|if|elif|else|menu)\s+([a-zA-Z0-9_.]+)\((.*)\)\s*:|^\s*(screen|label|class|layeredimage|def|init|if|elif|else|menu)\s+([a-zA-Z0-9_.]+)\s*:/;
just to mess around and now it gives me this:
The ifs are found and it misses the else and the menu. I think it has something to do with the regular expression, but I cannot pinpoint it.
I don't expect it to be fixed tbh, but could someone that knows what they're doing please just point me to the right direction (assuming it's feasible)?
Edit: As stated in the comments below, it isn't quite supported. I'd like to look into the possibility of running renpy directly from VS Code.
Maybe with some help from the Ren'Py team we could even get debugging to work directly from VSCode.
This would require some back and forth with the Ren'Py team, as I'm not sure if this is something they agree with. This might cause issues because it would require going around the launcher.
So I saw some code that allows renpy to execute directly.
How does this work/ what is is for exactly? Might be nice to document it somewhere.
Bugs me to no end that .rpy files just use the default plaintext file icon. I could absolutely draw up a custom VSCode-style icon for Ren'Py and set it all up, all that jazz. I probably will anyway for my own personal use but I figured y'all might be interested in adding it to the main plugin. Lemme know what you think.
While working on PR #68, the following question has come to my mind: Do we really need to apply our own rules for folding?
According to the VSCode documentation, there are two ways to define holding:
In VS Code, folding is defined either
indentation-based
, or defined by contributed folding range providers:
- Indentation-based folding with markers: If no folding range provider is available for the given language or if the user has set
editor.foldingStrategy
toindentation
, indentation-based folding is used. A folding region starts when a line has a smaller indent than one or more following lines and ends when there is a line with the same or smaller indent. Empty lines are ignored. Additionally, the language configuration can definestart
andend
markers. These are defined as start and end regexes infolding.markers
. When matching lines are found, a folding range inside the pair is created. Folding markers must be non-empty and typically look like//#region
and//#endregion
.- Language server folding: The Language Server responds to the
textDocument/foldingRange
request with a list of folding ranges, and VS Code would render the ranges as folding markers. Learn more about the folding support in Language Server Protocol at the Programmatic Language Feature topic.
Since both Python and Ren'Py use indentation in the code blocks, what is the need to define it through the provider?
What is your opinion about this?
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.