/*
 * Copyright 2013-2015 must-be.org
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.mustbe.consulo.nodejs.lang;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import com.intellij.lang.javascript.JavaScriptFileType;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.FileTypeRegistry;
import com.intellij.openapi.util.io.ByteSequence;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VirtualFile;

/**
 * @author VISTALL
 * @since 18.12.2015
 */
public class NodeJSFileTypeDetector implements FileTypeRegistry.FileTypeDetector
{
	@Nullable
	@Override
	public FileType detect(@NotNull VirtualFile file, @NotNull ByteSequence byteSequence, @Nullable CharSequence charSequence)
	{
		if(file.getName().equals("www"))
		{
			System.out.println("test");
		}
		if(FileUtil.isHashBangLine(charSequence, "/usr/bin/env node"))
		{
			return JavaScriptFileType.INSTANCE;
		}
		return null;
	}

	@Override
	public int getVersion()
	{
		return 2;
	}
}

@@ -1302,82 +1302,8 @@
 %0A%09%7B%0A
-%09%09if(file.getName().equals(%22www%22))%0A%09%09%7B%0A%09%09%09System.out.println(%22test%22);%0A%09%09%7D%0A
 %09%09if

debug removed