Giter VIP home page Giter VIP logo

Comments (19)

Lujia-Cheng avatar Lujia-Cheng commented on September 1, 2024 16

Found a way, although this might not relate to this project whatsoever.
Just type in below in terminal/cmd

npm install @types/screeps
npm install @types/lodash

Credit to:
Remoh(ID: UJL4HDL9Z) on Screeps Slack

from screepsautocomplete.

MrFaul avatar MrFaul commented on September 1, 2024 7

Add the line at the beginning:
/// <reference path="where/ever/ScreepsAutocomplete/is" />
and you are done -_- took me 3 days to find that...
Result is that I have now a entire tool chain working that I never wanted ... <- which worked before i got autocomplete to do something.

Code is awesome but wired in some ways I blame MS ;-P

from screepsautocomplete.

MrFaul avatar MrFaul commented on September 1, 2024 2

This is for some reason very buggy so I recommend putting it in every file, if you still have issues I recommend to switch to a typescript definition like screeps.d.ts sometimes it works without reference link sometimes not.
I still have no clue what's going on so I just tell you what "somehow" worked for me ^^

from screepsautocomplete.

quonic avatar quonic commented on September 1, 2024 2

Just in case someone happens upon this problem . Add _references.js to the ScreepsAutocomplete folder and VScode's intelisense works.

Also add jsconfig.json with the following to the root folder if your project:
{ "compilerOptions": { "target": "ES6" }, "exclude": [ "node_modules" ] }

from screepsautocomplete.

GWJYonder avatar GWJYonder commented on September 1, 2024 2

For future googlers, I was just able to get this working with a combination of MrFaul and quonic's advice. I added the _references.js file to the ScreepsAutocomplete folder as quonic suggested, and then added

/// <reference path="..\..\ScreepsAutocomplete\_references.js" />

to the tops of the file, not just a reference to the folder of the project. This worked without me needing to add a jsconfig file, at least I haven't yet.

from screepsautocomplete.

QAutoBotOP avatar QAutoBotOP commented on September 1, 2024 2

I got it working here summary:

  1. Add ScreepsAutocomplete-master to screeps/scripts/screeps.com/default

  2. Added ScreepsAutocomplete to main Screeps folder (in .../steamapps/common for me)

  3. Added _references.js to ScreepsAutocomplete folder

  4. Added jsconfig.json to ScreepsAutocomplete folder this is the file with in it:
    { "compilerOptions": { "target": "ES6" }, "exclude": [ "node_modules" ] }

  5. Opened a terminal from VSCode and did these two:
    npm install @types/screeps
    npm install @types/lodash

  6. Restarted VSCode and it works.

Some of these steps are not needed but it works. Just the summary, thanks to the guys above!! I've been trying to get this to work for quite some time now. Have fun gaming fellas.

from screepsautocomplete.

C0rn3j avatar C0rn3j commented on September 1, 2024 2

I just installed the NPM types, but if someone wants to generate up to date _references.js and not the one from 2017, I made a small snippet for Linux.
Didn't get to test it however.

cd ScreepsAutocomplete
rm -f _references.js
for i in $(find ./ -iname \*.js | cut -c3-); do echo "/// <reference path=\"${i}\" />"; done > _references.js

from screepsautocomplete.

Garethp avatar Garethp commented on September 1, 2024

Hi @venom-code If you look through the Readme, there should be instructions on how to make this work with VisualStudio. Does this not work for you?

from screepsautocomplete.

 avatar commented on September 1, 2024

I meen Visual Studio Code not Visual Studio :)

from screepsautocomplete.

Garethp avatar Garethp commented on September 1, 2024

Ah, gotcha. Is there a fair difference? Does the same process not work? What part of the process stops being the same for VSC? I'll look in to it, but if you can answer those upfront it may be quicker

from screepsautocomplete.

 avatar commented on September 1, 2024

VS Code is quite similar to Atom both are build on electron (an Javascript framework). I think extension in Atom are written in Coffescript right ? In VS Code you write extesions in Javascript. Here is an link for extension developing.. and so on https://code.visualstudio.com/docs/extensions/overview I hope, i could help you.
I love this editor so much :) Hope you can get it !

from screepsautocomplete.

Garethp avatar Garethp commented on September 1, 2024

I'll look in to seeing if I can make some installation instructions for it

from screepsautocomplete.

Eitz avatar Eitz commented on September 1, 2024

Any progress on this?

from screepsautocomplete.

zhengying avatar zhengying commented on September 1, 2024

any update?

from screepsautocomplete.

greenfrogs avatar greenfrogs commented on September 1, 2024

Has there been any progress on this?

from screepsautocomplete.

AVATAR-Phoenix avatar AVATAR-Phoenix commented on September 1, 2024

Nice ty @MrFaul , would i have to add this to each file though or just the first?

from screepsautocomplete.

Jason-Terry avatar Jason-Terry commented on September 1, 2024

This needs to be documented elsewhere. For more visibility.

from screepsautocomplete.

resb53 avatar resb53 commented on September 1, 2024

Building on GWJYonder's findings, I played around with the various permutations of the above a bit.

Seems like the
/// <reference path=.......
line needed to only be in one file. But that file needed to be open in VScode for it to work. So you could put it in every file to be safe... or in one, e.g. main.js and ensure it's always open.

I ran the same tests without using this line at all, but including quonic's jsconfig.json file in the root project folder, and it seems to have the same effect, working even with no other windows open.

These weren't fully comprehenesive, just checking how many options I was presented with for a creep object, but seems like quonic's advice gets it all working.

from screepsautocomplete.

ethanxxxl avatar ethanxxxl commented on September 1, 2024

I was able to get autocompletion working using @QAutoBotOP's method in emacs!

I am using doom, rjsx-mode with lsp integration enabled. this might be off topic, but for anyone who stumbles on this I made a hook which automatically copies the ScreepsAutocomplete directory (with modifications) into the current project directory, if it is a screeps project:

(add-hook 'rjsx-mode-hook
          (lambda ()
            "sets up auto-complete for screeps projects.

Checks if rjsx-mode is being run in a screeps project. If so,
then copy over the autocomplete files to the current directory.

there is a potential problem, where, if there are multiple
subdirectories, the autocomplete files will be copied over
multiple times. this may or may not be an issue."

            ; check if we are in a screeps project
            (if (and (string-match "Screeps/scripts"
                                   (file-name-directory (buffer-file-name)))
                     (not (file-exists-p "ScreepsAutocomplete/")))
                ;; we are in a screeps directory without the autocomplete files
                (copy-directory
                 "Absolute/path/to/Screeps/scripts/ScreepsAutocomplete/"
                 (file-name-directory (buffer-file-name))))))

from screepsautocomplete.

Related Issues (20)

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.