Skip to content

Commit

Permalink
Add settings and annotations for vs code extension (FAForever#3887)
Browse files Browse the repository at this point in the history
Initial support for intellisense! Adds annotations that a separately made Visual Studio Code extension can read and understand. Allows for a more modern development environment that can also be used for your mod and map scripts.
  • Loading branch information
hahn-kev authored Jun 8, 2022
1 parent 74596da commit 09e31f7
Show file tree
Hide file tree
Showing 138 changed files with 1,698 additions and 413 deletions.
28 changes: 28 additions & 0 deletions .vscode/fa-plugin.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---@class diff
---@field start integer # The number of bytes at the beginning of the replacement
---@field finish integer # The number of bytes at the end of the replacement
---@field text string # What to replace

---@param uri string # The uri of file
---@param text string # The content of file
---@return nil|diff[]
function OnSetText(uri, text)
local diffs = {}

local pos = text:match('^%s*()#')
if pos ~= nil then
diffs[#diffs + 1] = {
start = pos,
finish = pos,
text = '--'
}
end
for pos in text:gmatch '\r\n%s*()#' do
diffs[#diffs + 1] = {
start = pos,
finish = pos,
text = '--'
}
end
return diffs
end
34 changes: 32 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
{
"nuxt.isNuxtApp": false
}
"Lua.runtime.nonstandardSymbol": [
"continue",
"!="
],
"Lua.completion.showWord": "Disable",
"Lua.runtime.special": {
"import": "require",
"doscript": "require"
},
"Lua.runtime.version": "Lua 5.1",
"Lua.telemetry.enable": false,
"Lua.workspace.checkThirdParty": false,
"Lua.runtime.path": [
"/?"
],
"Lua.runtime.plugin": ".vscode/fa-plugin.lua",
"Lua.workspace.ignoreDir": [
".vscode",
"loc",
],
"[lua]": {
"editor.wordBasedSuggestions": false,
},
"Lua.completion.requireSeparator": "/",
"Lua.diagnostics.enable": true,
"Lua.runtime.pathStrict": false,
"Lua.runtime.exportEnvDefault": true,
"Lua.completion.autoRequire": false,
"Lua.diagnostics.globals": [
"ScenarioInfo"
],
}
218 changes: 218 additions & 0 deletions engine/BlueprintCategories.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
---@meta
---@declare-global

--- dummy value just so we have something to assign the categories to
---@alias CategorieType userdata
---@type CategorieType
local categoryValue

---@class Categories : table<string, CategorieType>
categories = {
ABILITYBUTTON = categoryValue,
ADVANCEDCOMBATPRESET = categoryValue,
AEON = categoryValue,
AIR = categoryValue,
AIRSTAGINGPLATFORM = categoryValue,
ALLPROJECTILES = categoryValue,
ALLUNITS = categoryValue,
AMPHIBIOUS = categoryValue,
ANTIAIR = categoryValue,
ANTIAIRPRESET = categoryValue,
ANTIMISSILE = categoryValue,
ANTINAVY = categoryValue,
ANTISHIELD = categoryValue,
ANTISUB = categoryValue,
ANTITORPEDO = categoryValue,
ARTILLERY = categoryValue,
ASF = categoryValue,
BATTLESHIP = categoryValue,
BENIGN = categoryValue,
BOMB = categoryValue,
BOMBER = categoryValue,
BOT = categoryValue,
BUBBLESHIELDPRESET = categoryValue,
BUBBLESHIELDSPILLOVERCHECK = categoryValue,
BUILTBYAIRTIER2FACTORY = categoryValue,
BUILTBYAIRTIER3FACTORY = categoryValue,
BUILTBYCOMMANDER = categoryValue,
BUILTBYEXPERIMENTALSUB = categoryValue,
BUILTBYLANDTIER2FACTORY = categoryValue,
BUILTBYLANDTIER3FACTORY = categoryValue,
BUILTBYNAVALTIER2FACTORY = categoryValue,
BUILTBYNAVALTIER3FACTORY = categoryValue,
BUILTBYQUANTUMGATE = categoryValue,
BUILTBYTIER1ENGINEER = categoryValue,
BUILTBYTIER1FACTORY = categoryValue,
BUILTBYTIER2COMMANDER = categoryValue,
BUILTBYTIER2ENGINEER = categoryValue,
BUILTBYTIER2FACTORY = categoryValue,
BUILTBYTIER2SUPPORTFACTORY = categoryValue,
BUILTBYTIER3COMMANDER = categoryValue,
BUILTBYTIER3ENGINEER = categoryValue,
BUILTBYTIER3FACTORY = categoryValue,
CANNOTUSEAIRSTAGING = categoryValue,
CANTRANSPORTCOMMANDER = categoryValue,
CAPTURE = categoryValue,
CARRIER = categoryValue,
CIVILIAN = categoryValue,
CIVILLIAN = categoryValue,
CLOAKPRESET = categoryValue,
COMBATPRESET = categoryValue,
COMMAND = categoryValue,
CONSTRUCTION = categoryValue,
CONSTRUCTIONSORTDOWN = categoryValue,
COUNTERINTELLIGENCE = categoryValue,
CQUEMOV = categoryValue,
CRABEGG = categoryValue,
CRUISER = categoryValue,
CYBRAN = categoryValue,
DEBUG = categoryValue,
DEFENSE = categoryValue,
DEFENSIVEBOAT = categoryValue,
DESTROYER = categoryValue,
DIESTOOCDEPLETINGSHIELD = categoryValue,
DIRECTFIRE = categoryValue,
DRAGBUILD = categoryValue,
DUMMYGSRWEAPON = categoryValue,
DUMMYUNIT = categoryValue,
ECONOMIC = categoryValue,
ENERGYPRODUCTION = categoryValue,
ENERGYSTORAGE = categoryValue,
ENGINEER = categoryValue,
ENGINEERPRESET = categoryValue,
ENGINEERSTATION = categoryValue,
EXPERIMENTAL = categoryValue,
FACTORY = categoryValue,
FAVORSWATER = categoryValue,
FERRYBEACON = categoryValue,
FIELDENGINEER = categoryValue,
FRIGATE = categoryValue,
GATE = categoryValue,
GROUNDATTACK = categoryValue,
HELPER = categoryValue,
HIGHALTAIR = categoryValue,
HIGHPRIAIR = categoryValue,
HOVER = categoryValue,
HYDROCARBON = categoryValue,
INDIRECTFIRE = categoryValue,
INSIGNIFICANTUNIT = categoryValue,
INTEL = categoryValue,
INTELJAMMERPRESET = categoryValue,
INTELLIGENCE = categoryValue,
INVULNERABLE = categoryValue,
ISPREENHANCEDUNIT = categoryValue,
LAND = categoryValue,
LIGHTBOAT = categoryValue,
LOWSELECTPRIO = categoryValue,
MASSEXTRACTION = categoryValue,
MASSFABRICATION = categoryValue,
MASSPRODUCTION = categoryValue,
MASSSTORAGE = categoryValue,
MISSILE = categoryValue,
MISSILEPRESET = categoryValue,
MOBILE = categoryValue,
MOBILESONAR = categoryValue,
NANOCOMBATPRESET = categoryValue,
NAVALCARRIER = categoryValue,
NAVAL = categoryValue,
NEEDMOBILEBUILD = categoryValue,
NOFORMATION = categoryValue,
NOSPLASHDAMAGE = categoryValue,
NUKE = categoryValue,
NUKESUB = categoryValue,
OMNI = categoryValue,
OPERATION = categoryValue,
OPTICS = categoryValue,
ORBITALSYSTEM = categoryValue,
OVERLAYANTIAIR = categoryValue,
OVERLAYANTINAVY = categoryValue,
OVERLAYCOUNTERINTEL = categoryValue,
OVERLAYDEFENSE = categoryValue,
OVERLAYDIRECTFIRE = categoryValue,
OVERLAYINDIRECTFIRE = categoryValue,
OVERLAYMISC = categoryValue,
OVERLAYOMNI = categoryValue,
OVERLAYRADAR = categoryValue,
OVERLAYSONAR = categoryValue,
PATROLHELPER = categoryValue,
PERSONALSHIELD = categoryValue,
POD = categoryValue,
PODSTAGINGPLATFORM = categoryValue,
PRODUCTDL = categoryValue,
PRODUCTFA = categoryValue,
PRODUCTSC1 = categoryValue,
PROJECTILE = categoryValue,
RADAR = categoryValue,
RALLYPOINT = categoryValue,
RAMBOPRESET = categoryValue,
RASPRESET = categoryValue,
RECLAIMABLE = categoryValue,
RECLAIM = categoryValue,
RECLAIMFRIENDLY = categoryValue,
REPAIR = categoryValue,
RESEARCH = categoryValue,
SATELLITE = categoryValue,
SCOUT = categoryValue,
SELECTABLE = categoryValue,
SERAPHIM = categoryValue,
SHIELD = categoryValue,
SHIELDCOLLIDE = categoryValue,
SHIELDCOMBATPRESET = categoryValue,
SHOWATTACKRETICLE = categoryValue,
SHOWQUEUE = categoryValue,
SILO = categoryValue,
SIMPLECOMBATPRESET = categoryValue,
SIZE4 = categoryValue,
SIZE8 = categoryValue,
SIZE12 = categoryValue,
SIZE16 = categoryValue,
SIZE20 = categoryValue,
SNIPEMODE = categoryValue,
SNIPER = categoryValue,
SONAR = categoryValue,
SORTCONSTRUCTION = categoryValue,
SORTDEFENSE = categoryValue,
SORTECONOMY = categoryValue,
SORTINTEL = categoryValue,
SORTOTHER = categoryValue,
SORTSTRATEGIC = categoryValue,
SPECIALHIGHPRI = categoryValue,
SPECIALLOWPRI = categoryValue,
STATIONASSISTPOD = categoryValue,
STEALTH = categoryValue,
STEALTHFIELD = categoryValue,
STEALTHPRESET = categoryValue,
STRATEGICBOMBER = categoryValue,
STRATEGIC = categoryValue,
STRUCTURE = categoryValue,
SUBCOMMANDER = categoryValue,
SUBMERSIBLE = categoryValue,
SUPPORTFACTORY = categoryValue,
T1SUBMARINE = categoryValue,
T2SUBMARINE = categoryValue,
TACTICAL = categoryValue,
TACTICALMISSILEPLATFORM = categoryValue,
TANK = categoryValue,
TARGETCHASER = categoryValue,
TECH1 = categoryValue,
TECH2 = categoryValue,
TECH3 = categoryValue,
TECH_THREE = categoryValue,
TECH_TWO = categoryValue,
TELEPORTBEACON = categoryValue,
TORPEDO = categoryValue,
TRANSPORTATION = categoryValue,
TRANSPORTBUILTBYTIER1FACTORY = categoryValue,
TRANSPORTBUILTBYTIER2FACTORY = categoryValue,
TRANSPORTBUILTBYTIER3FACTORY = categoryValue,
TRANSPORTFOCUS = categoryValue,
UEF = categoryValue,
UNSELECTABLE = categoryValue,
UNSPAWNABLE = categoryValue,
UNTARGETABLE = categoryValue,
USEBUILDPRESETS = categoryValue,
VERIFYMISSILEUI = categoryValue,
VISIBLETORECON = categoryValue,
VOLATILE = categoryValue,
WALL = categoryValue,
}
Loading

0 comments on commit 09e31f7

Please sign in to comment.