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

Code Editor 2: User-made snippets don't work #6344

Closed
KormexGit opened this issue Jun 19, 2024 — with GM Bug Reporter · 3 comments
Closed

Code Editor 2: User-made snippets don't work #6344

KormexGit opened this issue Jun 19, 2024 — with GM Bug Reporter · 3 comments
Assignees
Labels
documentation Improvements or additions to documentation are required by this issue ide-bug Bugs with the GameMaker IDE
Milestone

Comments

@KormexGit
Copy link

Description

In CE2, user made snippets cannot be accessed in any way, since the F4 menu is gone and they do not appear in autocomplete.

Steps To Reproduce

Try to use a user defined snippet.

Which version of GameMaker are you reporting this issue for?

IDE v2024.600.0.576 Runtime v2024.600.0.602

Which operating system(s) are you seeing the problem on?

Windows 10.0.22631.0

90b023b1-b594-408d-9fb9-94405408ce50

@gm-bug-reporter gm-bug-reporter bot added the ide-bug Bugs with the GameMaker IDE label Jun 19, 2024
@stuckie stuckie moved this from Triage to Todo in Team Workload Jun 20, 2024
@stuckie stuckie added this to the 2024.8 milestone Jun 20, 2024
@stuckie stuckie modified the milestones: 2024.8, 2024.10 Jul 18, 2024
@iampremo iampremo removed this from the 2024.10 milestone Aug 12, 2024
@zreedy zreedy added this to the 2025.1 milestone Nov 21, 2024
@zreedy zreedy moved this from Todo to In Progress in Team Workload Dec 9, 2024
@zreedy
Copy link

zreedy commented Dec 9, 2024

This feature is now implemented but its implementation might change in the future. (May adopt enumerating a directory of *.tmSnippet format files)
Currently, similar to CE1 behavior, if a snippets.txt file located at C:\ProgramData\GameMakerStudio2\User\snippets.txt then it will be loaded and added to the snippets when the Language Server is initialized. Changes to the snippets requires restarting the IDE to see the effects.
The format is that each line is a Snippet entry in the format NAME:VALUE, where NAME is what's displayed inside of the Code Completion List, and VALUE is a TextMate/LSP 3.17 compatible syntax. New Lines are escaped as \n

Please be mindful that the CE1 snippet syntax used $ to denote newlines, however this symbol escapes various directives in TextMate Snippet syntax (tab stops, variables, etc.) Any existing user snippets might be misinterpreted in CE2 if they are not converted.

Example
snippets.txt

custom:var year = ${CURRENT_YEAR};\nshow_debug_message(year); // ${CURRENT_YEAR}$0

Result
Image
Image

Snippet Syntax Documentation

@zreedy
Copy link

zreedy commented Dec 9, 2024

Non-standard Extensions to the Snippet Syntax.

Variables

  • CLIPBOARD: Contents of the clipboard
  • WORKSPACE_NAME: Name of current project (yyp filename without extension)
  • WORKSPACE_FOLDER: Path to yyp
  • CURSOR_INDEX: Column-1
  • CURSOR_NUMBER: Column
  • CURRENT_YEAR: yyyy
  • CURRENT_YEAR_SHORT: yy
  • CURRENT_MONTH: MM
  • CURRENT_MONTH_NAME: M
  • CURRENT_MONTH_NAME_SHORT: MMM
  • CURRENT_HOUR: HH
  • CURRENT_MINUTE: mm
  • CURRENT_SECOND: ss
  • CURRENT_SECONDS_UNIX: Now UNIX Timestamp (not UTC)
  • CURRENT_TIMEZONE_OFFSET: +HHMM
  • RANDOM: A random base 10 integer between inclusive 100000-999999
  • RANDOM_HEX: A random base 16 integer between inclusive 0x111111-0xFFFFFF (excluding leading 0x)
  • UUID: A new GUIDv4 in lower case with hyphens format

@zreedy
Copy link

zreedy commented Dec 11, 2024

An update for this ticket. We have now implemented support for *.tmSnippets where the snippets are loaded from C:\ProgramData\GameMakerStudio2\User\*.tmSnippet. This is the standard format. If there is a CE1 snippets.txt in that directory it will be upgraded one time to the *.tmSnippet format.

@zreedy zreedy closed this as completed Dec 11, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Team Workload Dec 11, 2024
@gurpreetsinghmatharoo gurpreetsinghmatharoo added the documentation Improvements or additions to documentation are required by this issue label Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation are required by this issue ide-bug Bugs with the GameMaker IDE
Projects
Status: Done
Development

No branches or pull requests

5 participants