oleg-shilo / cs-script.npp

CS-Script (C# Intellisense) plugin for Notepad++ (x86/x64)
MIT License
246 stars 52 forks source link

error CS1513: } expected (error CS1022: Type or namespace definition, or end-of-file expected) (csscript) #60

Closed it19862 closed 7 months ago

it19862 commented 3 years ago

error CS1513: } expected (error CS1022: Type or namespace definition, or end-of-file expected) (csscript)

Code

//css_ac
//css_import Use.cs
//css_reference System.Data.Linq.dll
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.Data.Linq.SqlClient;
namespace Folder_NS_02
{
    public class Test
    {
        public void main(string[] args)
        {
            User myClassTest = new User();

            var exceptonList = new[] { "ToString", "Equals", "GetHashCode", "GetType", ".ctor" };
            var members = myClassTest.GetType().GetMembers()
                 .Select(x => x.Name)
                 .Except(exceptonList);
        }   
    }
}

2021-07-26_16-30-19

2021-07-26_16-38-31

oleg-shilo commented 3 years ago

The problem is caused by the fact that you specify auto-class option (//css_ac) and it is trying to wrap your script into a class definition but... you are already using the class (Test).

So either remove //css_ac or clean your script as :

//css_ac
//css_imp Use.cs
//css_ref System.Data.Linq.dll

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Linq.SqlClient;

void main(string[] args)
{
    User myClassTest = new User();

    var exceptonList = new[] { "ToString", "Equals", "GetHashCode", "GetType", ".ctor" };
    var members = myClassTest.GetType().GetMembers()
                 .Select(x => x.Name)
                 .Except(exceptonList);
}
timeparrakeet commented 2 years ago

I'm getting the same error with my code when i try to make player movement for Unity normally it works but I'm not on the normal computer i use and now I'm getting this error I've copied and pasted my code bellow i was wondering if your solution would work for me. Thanks in advance for the help

code: using System.Collections; using System.Collections.Generic; using UnityEngine;

public class Testplayer : MonoBehaviour { public float speed;

private Rigidbody2D teriyaki;
// Start is called before the first frame update
void Start()
{
    speed = 5f;
    teriyaki = gameObject.GetComponent<Rigidbody2D>();
}

// Update is called once per frame
void Update()
{
    private float vert = Input.GetAxisRaw("vertical");
}
// this is ot do things whiht the physics engine 
void FixedUpdate()
{
    if (vert > 0.1f)
    {
        teriyaki.AddForce(new Vector2(0f, vert * speed), ForceMode2D.Impulse);
    }
}

}

oleg-shilo commented 2 years ago

What are you trying to do with that Testplayer class? I can see you cannot execute it. It is expected. So what exactly is the problem and how do you trigger it?